> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Helper functions

### connect(service\_layer\_url, user\_name=None, password=None, domain=None, autologon=None, timeout=300000, existing\_session=None, oidc=False, auth\_token=None, refresh\_token=None, use\_stored\_token=False, store\_password=False, max\_retries=0)

Establishes a connection to the Granta MI server and returns a [`Session`](https://developer.synopsys.com/docs/granta-mi/granta-mi-scripting-toolkit/4-2/api/session#GRANTA_MIScriptingToolkit.granta.mi.Session) object.

An existing session may be specified.

* **Parameters:**
  * **service\_layer\_url** – str
  * **user\_name** – str
  * **password** – str
  * **domain** – str
  * **autologon** – bool
  * **timeout** – int (maximum time to wait for a response, in milliseconds)
  * **existing\_session** – Foundation API [`GRANTA_MIScriptingToolkit.GRANTA_MISession`](https://developer.synopsys.com/docs/granta-mi/granta-mi-scripting-toolkit/4-2/foundation/api#module-GRANTA_MIScriptingToolkit.GRANTA_MISession) class
  * **oidc** – bool
  * **auth\_token** – str
  * **refresh\_token** – str
  * **use\_stored\_token** – bool
  * **store\_password** – bool (Default value False. Set to True when the password is given and needs to be saved
    for the session’s duration, for example when parallelisation is required.)
  * **max\_retries** – int (Default value 0. Maximum number of times to retry requests sent to the Service Layer.)
* **Returns:**
  [`Session`](https://developer.synopsys.com/docs/granta-mi/granta-mi-scripting-toolkit/4-2/api/session#GRANTA_MIScriptingToolkit.granta.mi.Session) object

#### NOTE

If MI Scripting Toolkit has been installed on the same server machine as Granta MI, then the Granta MI
server name *must* be specified in full in the url parameter. If you use ‘localhost’ or a loopback address, MI
Scripting Toolkit will be unable to use the specified user account to connect to Granta MI.

### extract\_parameter\_value(param\_value)

Returns the data value stored in a Foundation API [`GRANTA_MIScriptingToolkit.ParameterValue`](https://developer.synopsys.com/docs/granta-mi/granta-mi-scripting-toolkit/4-2/foundation/api#module-GRANTA_MIScriptingToolkit.ParameterValue) object.

#### Deprecated

Deprecated since version 4.2: This function will be removed in a future release.

* **Parameters:**
  **param\_value** – Foundation API [`GRANTA_MIScriptingToolkit.ParameterValue`](https://developer.synopsys.com/docs/granta-mi/granta-mi-scripting-toolkit/4-2/foundation/api#module-GRANTA_MIScriptingToolkit.ParameterValue) class
* **Returns:**
  str or float

### get\_foundation\_logger()

Return the logger used by the Foundation API (has the name “GDL”).

* **Returns:**
  [`logging.Logger`](https://docs.python.org/3/library/logging.html#logging.Logger) class

### log\_to\_file\_in\_local\_app\_data(path='Granta Design\\\MIScriptingToolkit\\\Python')

Set up the built-in Granta logger to log to a file in the user’s local app data directory
(%LOCALAPPDATA% on Windows, ‘\~/.appdata/’ on Linux).
The log file name is MIScriptingToolkitForPython\_YYYY.MM.DD.log and you can
specify the filepath. The default filepath is Granta Design/MIScriptingToolkit/Python.

#### WARNING

This function is deprecated and will be removed in a future version. To log messages
to a file, use the Python logging module. The Foundation Layer logger can be obtained
with the function [`get_foundation_logger()`](#GRANTA_MIScriptingToolkit.granta.mi_functions.get_foundation_logger).

* **Parameters:**
  **path** – str
* **Returns:**
  None
