Callback won't work

Hi, I’m developing a dashboard and I have different tabs that show different pages. For each page content I’ve created a different .py that specifies the layout, the dataframes and so on. Everything was fine until I tried to make the callback in order to change a graph according to a dropdown selection, because it doesn’t work. I have the corresponding callback inside each document and in I call the layout with

@app.callback(Output(“page-content”, “children”),
Input(“tabs-styled”, “value”))
def render_content(tab):
if tab == “america”:
return america.layout
elif tab == “europe”:
return europe.layout
elif tab == “asia”:
return asia.layout
elif tab == “africa”:
return africa.layout
return america.layout

I don’t get why wouldn’t it work. It doesn’t even show a figure, just the space. I would much appreciate some help.

Hola @mariasanchez

I’m not an expert in using multi page apps (indeed I don´t use it), but I think that the callback must be included in the main app (not in each .py file).

1 Like

Thanks a lot, I think it worked!

You think ? :thinking: :joy:

De nada, es un placer :grinning: