I am working on a large project in VS code. I have various subfolders with plenty of .py files. Then I have a main.py in the main folder. I want to import various functions form various files that exist in different subfolders. I find “from * import *” very redundant process. What is the efficient way to do it? Or how does a professional python developer does it?
my_project/
├── FolderA/
│ ├── __init__.py
│ └── module_a.py
├── FolderB/
│ ├── __init__.py
│ └── module_b.py
├── FolderC/
│ ├── __init__.py
│ └── module_c.py
├── __init__.py
└── main.py
Let’s say the above is my structure. And I want to call functions in main.py from module_a.py,module_b.py and module_c.py. Thanks.
I tried the following, but I can keep doing it for 10/20 functions:
from FolderA.module_a import functionA
from FolderB.module_b import functionB
from FolderC.module_c import functionC
Also tried the following, it didn’t work:
sys.path.append("D:Python_workspacesoftware")