Trying to put on big boy pants with python by creating modules.
I have the following structure:
main_folder\
sub_folder\
__init__.py
fileA.py
fileB.py
folder1\
__init__.py
file1A.py
file1B.py
folder2\
__init__.py
file2A.py
file2B.py
file1A
, file2A
, file2B
, file2B
all call fileA
and fileB
as well as other packages. fileA
can contain a function, a class...
I'm looking for a nice way to have a "universal import" (thinking of a header file in C) from which i can place in file1A
, file1B
or __init__
so that when starting from the main_folder, I can run:
import sub_folder.folder1.file1A
And it not throw a
NameError: name 'fileA' is not defined
edit: while I have seen several solution that involves setting paths that's not really the goal. I guess I'm more looking for python's equivalent to header file