Interpreter Errors Using TestStand Python Adapter

Updated Apr 8, 2022

Reported In


  • TestStand

Issue Details

I am getting errors from TestStand after running my sequence using the Python Adapter, some of the errors can be listed below: 

Unable to use PyObject created in another python interpreter session. You can use PyObject which is created in same python interpreter session. 

Python interpreter session crashed. If a console is displayed, closing the console will crash the interpreter. Complete all executions, unload all modules and retry executing the sequence file.


Why is this happening and what can I do to resolve it? 


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.