Event when Python DUT parameter is changed by user?

We are finalizing a decision to go with OpenTAP for our development testing and I have been evaluating adding some functionality that I have a Python library for.

My problem is that when the DUT signal file changes I need to reload the file so new signals get serialized when the testplan is saved.

I can do this fine in init when I hardcode the DUT filename and I can load it in when the DUT is opened in the Test Run. Once the signals are loaded and serialized they are fine since they are loaded after init is run. If the file changes the signals a stale and the list of available for steps is wrong. I can work around this by running the test with the bad signals so DUT Open reads the current ones in, then going back to edit, but this will mean someone will run with stale signals and not notice therefore invalidating the test.

Is there a way I can run the load function after the DUT is initialized and the serialized data is loaded?

Is there a way I can run the load function when the user selects a new DUT file?

Is there a way I can run the load function for the DUT(s) when the testplan is loaded (before run)?

And this is in Python because I have libraries in Python, and I am not a software engineer so taking the C# code we have for another application and using it as a library is more than I am comfortable with.

Unfortunately, since i need the list of signals for test steps

Hi @robert.lamoreaux and welcome to the forum!

You cannot get an event when the property is changed by the user specifically, but you can get an event when the value changes in general.

Doing this requires a slightly different way of implementing the property, you can find it below:

from clr import clrproperty

class TestStepExample (TestStep):
    # Create a get and a set method. The set method reacts to the value being set.
    def get_number(self):
        return self.number
    def set_number(self, value):
        self.log.Debug("Setting number2 to {0} ", value)
        self.number = value
    #use clrproperty instead of property. This enables slightly more advanced functionality.
    Number = clrproperty(Int32, get_number, set_number)
    def __init__(self):
        #initialize self.number.
        self.number = 10
        super(TestStepExample, self).__init__()
   # ...