Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Callbacks in return from function

I’m editing the financial report template for my own purposes. In app.py they make a callback of the function overview.create_layout(app) and they describe this function as:

def create_layout(app):
    return html.Div([
        ...
    ])

My question is the next. I want to use a callback for a dropdown filter but I don’t know where to put the @app.callback in the create_layout(app), if I have to put it inside. Everytime I run the code the dropdown does not filter by the callback condition

Hi,

Welcome to the community!

I don’t think it will work to add to the function, as the callbacks need to be defined when the application starts.

You could whether add it to the app main file or add to the sameoverview module as the create layout function, as long as you import app from main.

Please take a look on the docs for details regarding multi-page applications, in particular with respect to the need of a validation layout.

Thanks! It did help.