Unwatch "depends" decorator

As I understand @pm.depends add watchers. Is it possible to remove them later?

import param as pm



class A(pm.Parameterized):
    a1 = pm.Number(10)
    a2 = pm.Number(100)

class B(pm.Parameterized):
    b = pm.ClassSelector(class_=A)
    
    def __init__(self, **params):
        super().__init__(**params)
    
    @pm.depends("b.a1", watch=True)
    def callback(self):
        print(f"a1={self.b.a1}, a2 = {self.b.a2}")

a = A()
b = B(b=a)

a.a1 = 12
1 Like

In theory yes as they are watchers and listed somewhere. But I don’t know where.

But if you use the explicit watcher api then it should be relatively straightforward.

You can read about watch here and unwatch here.