Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

App Callbacks Runnning when they aren't supposed to

I am trying to make an app with two app.callback functions that will be run when the user clicks one of two buttons. However, everytime I access 127.0.0.1:8050 it runs the app.callbacks without clicking either button.

This is the error I get:

My guess is that you need to use dash.dependencies.State in the function graph1_update, but it’s not clear until you share the details of that function.

Basically State makes sure to only call the function after the button is clicked, if setup correctly.

Here is the official tutorial on State: https://dash.plot.ly/state, check out the second example. You can see in the given example that the text is only updated with you click the button, which is probably what you are looking for?

1 Like