Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Where do I put callback functions in a multi-page app with inputs and interactive graph?

Hello beautiful community,

I am working a multi-page Dash app that take inputs from users and updates a dcc.Graph() accordingly.
I do not know where to place my callback functions.

In one file (‘’) I have my first app’s layout.
In a second file (‘’) I have my second app’s layout.
In a third file (‘’) I have the layout for my home page.
In a fourth file (‘’) I have my code linking both pages to a home page:

app.layout = html.Div([
    dcc.Location(id='url', refresh=False),

@app.callback(Output('page-content', 'children'),
              [Input('url', 'pathname')])
def display_page(pathname):
    if pathname == '/':
         return home.layout
    elif pathname == '/simulation1':
         return app_1.layout
    elif pathname == '/simulation2':
         return app_2.layout
        return '404'

When I make a single page app, I usually place my callback function after my layout, but here, since my ‘’ is only calling the layout, it does not retrieve the callback placed after it.

I was wondering if anyone know where I need to put my callback functions?

Thank you in advance.