Updating Python Modules while Debugging
- Updated2025-03-28
- 1 minute(s) read
Updating Python Modules while Debugging
Note The following steps are useful during
test development and debugging. However, NI recommends you avoid reloading updated
Python modules when running tests in a production environment.
-
Ensure that Reload Modified Modules Before Execution is
enabled in the Python Adapter Configuration dialog box.
Note TestStand prompts you to unload all modules when you modify this setting.
- Execute the sequence and step into a Python code module.
- While execution is stopped, modify the code module the Python step calls, then resume execution. TestStand will use any modifications you make when it executes the step.
- Reloading an updated module behaves like importing the module for the first time. Global variables are reset to the default value, and any statement at the module level is executed.
- TestStand reloads only the module the step executes, but not dependent modules.
- If you modify a module that defines a class and another module stores an instance of that class, TestStand does not reload the second module when it reloads the first one. You must reload the second module to discard any instances of the objects and create new instances.
- If any Python object such as a class instance exists, and you modify the object, you must recreate the class instance after reloading the module.