Updating Python Modules while Debugging

You can modify and reload Python modules while debugging a test sequence.
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.
  1. 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.
  2. Execute the sequence and step into a Python code module.
  3. 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.
The following are the known limitations when updating modules while debugging:
  • 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.