✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Callbacks with multiple inputs

@app.callback(
[
Output(“video-display”, “url”),
Output(“PDI”, “children”),
Output(“Max-worker-count”, “children”),
Output(“crowding-violations”, “children”),
Output(“distancing-violations”, “children”),
Output(“mask_violations”, “children”),
Output(“msk_Max-worker-count”, “children”),
Output(“tbs-1”, “children”),
Output(“tbs-2”, “children”)
],
[
Input(“dropdown-footage-selection”, “value”)
Input(“dropdown-footage-selection”, “value”)

]

)

My callback looks like this, in which there are two inputs and 9 outputs. The outputs only change when both inputs changes. Is it possible that if either one of the input changes the output also changes?

Hi @abajaj945 maybe there is a typo in your code because the two inputs are the same. A Dash callback is triggered when ANY of the inputs is changed, you don’t need all of them to change. It is also possible to know which input triggered the callback thanks to dash.callback_context (see https://dash.plotly.com/advanced-callbacks).

1 Like