I have two parameterized classes: first is with settings, second is uses ClassSelector(class_=first) and has additional data.
And I dynamically add and remove Second class instances. But how to delete Second classes entirely, because callbacks is activated even after deletion.
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)
c = B(b=a)
a.a1 = 12
del b
a.a1 = 13