i am trying to import helper funcs into my main file, but it doesnt seem to work
the file is right next to it in the repo ( henosBot/dashboard (github.com))
i am trying to import helper funcs into my main file, but it doesnt seem to work
the file is right next to it in the repo ( henosBot/dashboard (github.com))
Hey @henosBot,
So I dont think this would work (even locally) because you have to specify the folder of your database.py
file, even though it’s being imported into another file in your website/
directory. (At least this is how I have been able to get all my other scripts working, both locally and on Sharing.)
I mocked up an example, that has the same directory structure as you do:
main_dir/
- an_app.py <--- my main app file
- modules/
- mod_1.py # first I import this into my an app file
- mod_2.py # I import this into mod_1.py which is imported into an_app.py
Then in the mod_1.py
file to import the mod_2.py
without any module not found errors use:
import modules.mod_2 as mod
Happy Streamlit-ing!
Marisa
Thanks, it works now
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.
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.
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.
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.