I have a dash apllication and the following 4 Modules. app needs to be imported from dashboard.py and tab_OIA.py as both modules work with app. This is also the way recommended by the plotly dash website:
app.py:
import dash app = dash.Dash(__name__,suppress_callback_exceptions=True)dashboard.py:
from app import app from tab_OIA import tab_OIA_layout . . . if __name__ == '__main__': app.run_server(debug=True, threaded=True)tab_OIA.py:
from app import app import data tab_OIA_layout = html.Div(.....) @app.callback() def function(): return ..data.py:
import pandas *calculate stuff* print("Everything calculated")
When I run dashboard.py in cmd it shows the following and "Everything calculated" appears twice:
C:\Users\.spyder-py3>python dashboard.py
Everything calculated
Running on http://127.0.0.1:8050/
Debugger PIN: 111-463-400
* Serving Flask app "app" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
Everything calculated
Running on http://127.0.0.1:8050/
Debugger PIN: 101-604-170
Calculating the data twice takes a lot of time. Why does that happen? Is there a way to avoid that?