You can use the Advanced Settings Dialog to specify which Python interpreter session to use for executing the step. You can specify one of the following options:

  • Object Reference—Use the interpreter session present in interpreter reference
  • Per Thread—Use the interpreter session created per TestStand thread
  • Per Execution—Use the interpreter session created per TestStand execution
  • Global—Use the interpreter session created once per TestStand application

You can use multiple Python interpreter session to execute Python scripts in parallel or use multiple Python versions simultaneously.

Execute Python Scripts in Parallel

CPython is one of the most used Python interpreters. It has a Global Interpreter Lock (GIL) due to which only one Python thread can be executing at any given point of time. Hence, you cannot perform any multi-threaded operation in Python to execute operations in parallel.

National Instruments recommends you to use multiple Python interpreter session to execute Python modules in parallel. If you want to handle device instruments using Python, you should create an interpreter session for each instrument so that all instruments can be operated in parallel.

Use Multiple Python Versions Simultaneously

You can also use multiple Python interpreter sessions to use different Python versions together in the same TestStand execution.

Note   A Python object created in a Python interpreter session and stored in a TestStand variable of type object reference should only be used in that session.