When a Python object is created, it is done so within a given interpreter. The objects created within one interpreter cannot be shared with another interpreter. The interpreter that a given code module is using can be configured using the Adapter Settings or the Advanced Settings of the Python Step.
The Python Adapter can be configured to use interpreters on a Global, Per Execution, or Per Thread basis. The TestStand Help documentation explains what each of these settings do.
- Global—All Python modules execute in a single instance of the Python interpreter.
- Per Execution—Each execution uses a separate instance of the Python interpreter to execute modules.
- Per Thread—Each thread uses a separate instance of the Python interpreter to execute modules.
An individual Python step can choose to use the Adapter Settings or an Object Reference for its interpreter session, creating one if it does not exist. These settings are accessed through the advanced settings button in the Step Settings.
Given the possibility of multiple interpreters, it is important to keep track of which objects belong to which interpreter. If an object reference from one interpreter is brought into TestStand, it must be used within that interpreter in subsequent steps.