The Open action in Python Script for API Task package opens a session for executing the Python scripts.

Overview

The Open action creates a new Python session that subsequent Python actions can reference by session name. You can define the source Python script by importing an existing file or entering code directly in the text field.

Settings

The following settings are available in the Open action:

Python
The source for the Python session. You can either select a Python script file or enter the code directly.
  • Import existing file: Specify the Python file to import. Select one of the following source tabs, then provide the path or variable reference:
    • Variable: Select a file variable that holds a file stream containing the Python script.
    • Control Room file: Select a Python script file from the Control Room repository.
    • Desktop file: Select a Python script file from the local desktop.
  • Manual input: Enter Python code directly in the Enter script here field.
New Python session
The session name identifies the current Python session. Use this name in subsequent Python actions to execute the source script. The action assigns Default as the pre-configured session name. You can choose one of the following options to define the session name:
  • Local session: Select to create a session name that can only be used in the current API Tasks.
  • Global session: Select this option to define a global session name that enables you to share the Python session across multiple API Tasks.
  • Variable: Select or create a session variable to define the session name.