Some months ago y started working in a small project that over the time became big. It started with a few python files:
project
│ program_1.py
│ program_2.py
We continue adding more programs, so in order to avoid code repetition I started extracting common functions to separate files.
project
│ program_1.py
│ program_2.py
│ program_3.py
│ shared_module_1.py
│ shared_module_2.py
We keep adding some more programs and they had a considerable size so I put them inside their own folders just like this. Also to avoid dropping more files inside the project folder (This is just a reduced example, folder has 15+ files):
project
│ program_1.py
│ program_2.py
│ program_3.py
│ shared_module_1.py
│ shared_module_2.py
└───program_4
│ program_4.py
│ program_4_aux.py
In order for the program_4.py to use the shared modules I had to use the following statement:
sys.path.append('../')
I am unable to keep up like this. Code is getting messy and hard to maintain. I have no idea how to clean this mess.
PD: I try using from .. import shared_module_1
but it tells me parent module '' not loaded cannot perform relative import
Thanks you very much for your time.