Dash app Callback error: Duplicated Callback output error in dash app

Viewed 323

I find it very bizarre, because the multi-page dash app worked in the first place. I did not change any command. I simply took a break and come back to rerun the dash app on pycharm. Then I got this error: enter image description here

My python script for the multipage app is (p.s. tree_app and tree_app2 are just two separate pages):

from dash import dcc
from dash import html
from dash.dependencies import Input, Output

# Connect to main app.py file

from app import app

# Connect to your app pages
from apps import tree_app2
from apps import tree_app

app.layout = html.Div([
    dcc.Location(id='url', refresh=False, pathname=''),
    html.Div([
        dcc.Link('Map|', href='/apps/tree_app'),
        dcc.Link('Graph', href='/apps/tree_app2'),
    ], className="row"),
    html.Div(id='page-id', children=[])
])


@app.callback(Output('page-id', 'children'),
              [Input('url', 'pathname')])
def display_page(pathname):
    if pathname == '/apps/tree_app':
        return tree_app.layout
    if pathname == '/apps/tree_app2':
        return tree_app2.layout
    else:
        return 'error 404'


if __name__ == '__main__':
    app.run_server(debug=True)
0 Answers
Related