I have done flask integration with Dash (credit to source) with file structure as below...
/<main_app>
     |
     |
     - <app>
     |  |-----__init__.py
     |
     - <dashboard>
     |  |--------Dash_App1.py
     |  |--------<dash_app_code1>
     |  |--------<dash_app_code2>
     |
     - <configs>
     |
     ----- run.py
run.py has following code...
from app import create_app
app = create_app(config_mode)
if __name__ == "__main__":
    app.run(debug = True)
"init.py" of the directory "app" has following code...
def create_app(config, selenium=False):
    app = Flask(__name__, static_folder='base/static')
    app.config.from_object(config)
    register_extensions(app)
    register_blueprints(app)
    app = Dash_App1.Add_Dash(app)
    return app
So I instantiate my Dash app in "Dash_App1.py" in "dashboard" directory like this.
def Add_Dash(server):
    d_app = Dash(server=server, url_base_pathname=url_base)
    apply_layout_with_auth(d_app, layout)
    @d_app.callback(Output('tabs-content', 'children'), Input('tabs', 'value'))
    def render_content(tab):
    if tab == 'tab-1':
        output = general_layout()
        return output
    @d_app.callback(Output('date-text', 'children'), Input('btn-cboe-data', 'n_clicks'))
    def readDaily(cobe_btn):
       if cobe_btn:
           do_something()
    return d_app.server
Here is my problem....Seems this design is forcing me to have all the callbacks in Add_Dash function in Dash_App1.py file. I want to organize my callbacks based on functionality in directories <dash_app_code1> and <dash_app_code2> in different files. But I don't know how to do this. I tried using "from flask import current_app" and tried to add callbacks there but it doesn't work. I tried assigning dash instance (d_app) to the global variable "g" and tried to import (and use) that in <dash_app_code1> but it throws out of context error. How can I add more dash related callbacks in files in different directories (<dash_app_code1> and <dash_app_code2> and avoid having all in Add_Dash function ?
