Black Lives Matter. Please consider donating to Black Girls Code today.

Callback with dynamic states for one button

Now, I’m trying to make callback with dynamic states.

In detail, there are 2 systems for that.

If user select system1, then dcc.dropdown is displayed according to system1.

ex) Input1, Input2, Dropdown1

For system2, ex) Dropdown1, Dropdown2 …

so, there are dynamic States, and these are already developed in my source code.

But, the problem is, I don’t know how to make callback with it… Because states are dynamic…

Is there any way? Now I’m trying to make it like below. But it didn’t work…

@app.callback(Output(‘button-dummy’, ‘children’), [Input(‘button’, ‘n_clicks’)],
STATES) # STATES is a flexible list for system
def on_click_run(click, *args):
if system == system1:
things…
elif system == system2:
things…

I tried to make dynamic callback for one output,
using " del app.callback_map[‘button-dummy.children’] ", and make new one. But it didn’t work…

In addition apart from the original question, is there any way to make callback at runtime?