I am trying to publish a dash app via plotly cloud. The app works without error when run on a local host but when I try to publish the app i get ModuleNotFoundError error regarding internal imports in the run rime on plotly-cloud.
I am using python v.3.13, dash[cloud] v.4.0.0, plotly v.6.5.2, dcc v.2.0.0, dbc v.2.0.4, plotly cloud v.0.1.0, and gunicorn v.24.0.0. I run the code with uv on a mac. The relevant parts of my file structure are as follows:
root_folder/
├── Procfile
├── pyproject.toml
├── requirements.txt
├── src/
│ ├── __init__.py
│ ├── main.py # entry point for code is here
│ ├── app/
│ │ ├── .DS_Store
│ │ ├── __init__.py
│ │ ├── app_factory.py
│ │ ├── components/
│ │ │ ├── __init__.py
│ │ │ ├── page_1.py
│ │ │ ├── page_2.py
│ │ │ └── etc.py
│ │ ├── dashboard_logic.py # ModuleNotFoundError is here when calling get_slider_params
│ │ └── plotly-cloud.toml
└── uv.lock
I use main as the entry point here because I have a separate data loading, processing and validation schema (all not shown here). I assume that the data pipeline in the src folder (and now shown here) play no role in the error. The error arises at the first internal import called in app_factory, which I have called as an absolute import as follows:
from .dashboard_logic import get_slider_params
The dash app is created in main via the following code.
from app.app_factory import create_dash_app
if __name__ == "__main__":
app = create_dash_app(*args)
app.run(debug=True, use_reloader=False, port=8051)
server = app.server
I get this output with the build (all standard imports also seem to load well - not shown here):
Build
Archive: /tmp/app.zip
inflating: /home/appuser/app/app_factory.py
inflating: /home/appuser/app/.DS_Store
inflating: /home/appuser/app/dashboard_logic.py
inflating: /home/appuser/app/__init__.py
inflating: /home/appuser/app/plotly-cloud.toml
inflating: /home/appuser/app/base_graphs.py
inflating: /home/appuser/app/components/home.py
inflating: /home/appuser/app/components/__init__.py
inflating: /home/appuser/app/components/night_vs_day_feeds.py
inflating: /home/appuser/app/components/individual_feeds.py
and these errors in the runtime:
2026-02-10T13:52:49.619Z: File "/home/appuser/app/app_factory.py", line 12, in <module>
2026-02-10T13:52:49.619Z: from .dashboard_logic import get_slider_params
2026-02-10T13:52:49.619Z: ImportError: attempted relative import with no known parent
I have separately tried loading the imports in the __init__.py files in the components and app folders, as well as using relative imports. I have tried adding the src folder to the pythonpath. In all attempts mentioned above, the app runs without error on a local host and it is only when i try to publish the app via plotly-cloud that i get the failure message referenced above.
I have seen some questions relating to third-party imports but I have not seen found an similar posts on issues relating to internal imports…Can you help me identify why this is not working and what I can do to resolve this?