On streamlit cloud, my multipage app cannot import modules from the directory above. The error looks like:
File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 557, in _run_script
exec(code, module.__dict__)
File "app/home.py", line 5, in <module>
import lenders.elastic as elastic
ModuleNotFoundError: No module named 'lenders'
This ran fine on my local machine, which is weird.
Hello guys,
I have the exact same issue if try to run the app on the docker or locally. I am unable to import modules which lie outside of the streamlit app directory. But in pycharm if i setup the run configuration to include my source root it works the app is able to load and work. I have also tried adding the path into the config.toml in .streamlit folder under [server] config but still no luck
Any guidelines how to do for multi page app as the streamlit file doesn’t lie in the root directory. This is what my directory structure looks like. Please the streamlit_app is the directory for the app and I want to import functionlist as a module
It would be nice if the st.set_page_config command could include a hide_page parameter so that our functional .py files could lie inside the same directory.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.