I am building a dashboard using panel and trying to figure out how to have a change of a control ("threshold" in the below class) fire a process that updates an attribute of the class before any other functions are called that will use that attribute. Basically, a change in the threshold widget should change an attribute self.table and then more than 1 functions will reference it to create tables and plots for the dashboard. How to make this happen? This is the start of the class where the widgets are declared and the class initialized....
class BinaryPerformDashComponents(param.Parameterized):
bins = param.ObjectSelector(default=10, objects=[], label='Number of Bins')
threshold = param.Number(default=0.5, step=0.01, bounds=(0, 1), allow_None=False)
def __init__(self, actual, pred, df, *args, **kwargs):
super(type(self), self).__init__(*args, **kwargs)
self.param.bins.objects =[5,10,20,50,100] # set the list of objects to select from in the widget
self.df = self.create_df(actual,pred,df)
Here's an example where a change in a parameter threshold, changes the value of a boolean, and because that boolean changes, other updates get triggered after that:
Here's some other questions + answers using the same mechanism:
Use button to trigger action in Panel with Parameterized Class and when button action is finished have another dependency updated (Holoviz)
How do i automatically update a dropdown selection widget when another selection widget is changed? (Python panel pyviz)