This is my file structure.
/working dir
__init__.py
main.py
/packages
__init__.py
snafu.py
/subfolder1
__init__.py
foo.py
/subfolder2
__init__.py
bar.py
/many_more
...
If I run main.py
it will try to import, from subfolder1.foo import something
But foo.py
will try to import subfolder2
which won't work because subfolder2
is not found.
It would be way too much work to go into every file and change every import statement to from packages.a_subfolder.whatever import something
I have gotten it to work by adding /packages
to the sys.path
, but I would prefer not to do this. Is there a way to fix this using __init__.py
files?
Would adding import *
to the /packages __init__.py file work?
The many_more/ folders are third party packages I downloaded, since i work on this on different computers instead of installing the packages on every computer I work on it just uses the one in the folder. For example: to use googledrive in your program you need about 10 different packages to get it to work.