9.61.2 Python Module

With the Python Module configurations, you can write shared Python code that can be imported by multiple Python agents. This allows you to organize your Python code in different modules that can be reused.


Python Module configuration

To open the editor, click the New Configuration  button in the upper left part of the Desktop window, and then select Python Module  from the menu.

Hint!

To maximize the code area, double-click the dotted triangle in the lower right corner of the Configuration dialog. This is a useful feature when coding.


The entire Python Module configuration is a code area where you can write code that you want Python agents to be able to import. See the code section for the relevant agent for further information.

The imported modules are referenced by the workflows, but as each agent has its own memory space, global variables will not be shared between agents or workflows.

Module Menus

The main menu changes depending on which configuration type has been opened in the currently active tab. There is a set of standard menu items that are visible for all configurations and these are described in 2.1 Menus and Buttons.

The menu items that are specific for the Python Module are described in the following sections.

File Menu

OptionDescription

Import...

Select this option to import code from an external file. Note that the file has to reside on the host where the client is running.

Export...

Select this option to export your code to a *.py file that can be edited in other code editors, or be used by other  systems.

Edit Menu

OptionDescription

Validate

Validates that the Python syntax in the configuration is correct.

The Python Language Service tool must be running to enable the validation function. For further information, see 9.61.4 Python Language Service.

Undo

Select this option to undo your last action.

Redo

Select this option to redo the last action you "undid" with the Undo option.

Cut

Cuts selections to the clipboard buffer.

Copy

Copies selections to the clipboard buffer.

Paste

Pastes the clipboard contents.

Find...

Displays a dialog where chosen text may be searched for and, optionally, replaced.

Find Again

Repeats the search for the last string entered in the Find dialog.

Module Buttons

The toolbar changes depending on which configuration type is currently open in the active tab. There is a set of standard buttons that are visible for all configurations and these buttons are described in 2.1 Menus and Buttons.

The additional buttons that are specific for the Python Module are described in the following table.

ButtonDescription

Validate

Validates that the Python syntax in the configuration is correct.

The Python Language Service tool must be running to enable the validation function. For further information, see 9.61.4 Python Language Service.

Undo

Select this option to undo your last action.

Redo

Select this option to redo the last action you "undid" with the Undo option.

Cut

Cuts selections to the clipboard buffer.

Copy

Copies selections to the clipboard buffer.

Paste

Pastes the clipboard contents.

Find...

Displays a dialog where chosen text may be searched for and, optionally, replaced.

Find Again

Repeats the search for the last string entered in the Find dialog.

Zoom Out

Zoom out the Python code area by modifying the zoom number that you find on the toolbar.

Zoom In

Zoom in the Python code area by modifying the zoom number that you find on the toolbar.

Python Code Editor Assistance

To provide assistance when you are writing code in the Python code area, there are several features in place:

Syntax Highlighting - Different parts of the code are color coded according to type

Right-Click Menu - A menu which provides editor options

Code Completion - Code Completion which helps you to write Python code in the Python Code Editor by providing context-sensitive proposals.

Python Code Editor Outline - An outline navigation panel to make it easier to navigate in a Python code configuration

For further information on these features, see 9.52.3 Python Code Editor Assistance.

Configuration Diff Panel

If you want to compare the current version of a Python Module configuration that you are displaying with a previous version of the same configuration, you can use Configuration Diff to compare the two versions side by side.

To hide or display the Configuration Diff panel, click the vertical Diff button to the right of the Python Module configuration dialog. The panel can be hidden or visible. By default, it is hidden.

Python Module configuration - Configuration Diff panel

You can navigate through the differences by scrolling both panes in parallel using the scroll bar to the right of either pane. If you want to scroll through each pane separately, hover over the pane that you want to scroll through, and use the scroll wheel on your mouse.

If you want to skip through each difference in the panes, you can use the navigation buttons, Previous, Next and Refresh, which are described below.

SettingDescription
History

Click the History drop box to select the version to which you want to compare the version currently displayed.

You can also display and view encrypted configurations. If you select an encrypted configuration, you are prompted to enter the relevant password to decrypt the configuration.

Previous
 
Click this button to skip to the previous difference in the configurations. The previous difference is highlighted in green.
Next
 
Click this button to skip to the next difference in the configurations. The next difference is highlighted in green.
Refresh
 
Click this button to display the updated version of the configuration. Configurations are not locked when you display them in Configuration Diff. If another user has modified and saved a configuration that you are viewing in this tool, you can click this button to view the latest updated version.