how do you listen to setters from imported classes?

The solution I went for is as follows, using a ‘Proxy’ subclass which overrides the properties. Eventually, once I have a better understanding of the watched parameters, I won’t need to watch them anymore. At this point I will be able to swap out the Proxy for the base class and continue using the code as normal.

class MyAlgorithmClassProxy(MyAlgorithmClass):

    def watch_param1(self):
        return MyAlgorithmClass.watch_param1.fget(self)

    def watch_param1(self, value):
        self._socket.emit('param1_updated', *args)
        MyAlgorithmClass.watch_param1.fset(self, value)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top