I have the following structure
my_scripts
    group_A
        group_A1
            main.py
            dbFunctions.py
        group_A2
            main.py
            dbFunctions.py
    group_B
        scripting_Im_running_things_from.py
        dbFunctions.py
I want to load  one function from each of the main.pys, and am trying to do it with sys.path.append. But because the folder I am running my main script from (group_B) has dbFunctions.py as well, none of the other two models' functions (ie. group_A1\main.py and group_A2\main.py) can utilise functions from their respective dbFunctions.py modules so I am getting an import error:
ImportError: cannot import name 'my_function_in_groupA1_dbFunctions' from 'dbFunctions' (C:\my_scripts\group_B\dbFunctions.py)
(I also tried renaming
group_B\dbFunctions.pytogroup_B\_dbFunctions.pyand adding thegroup_A1andgroup_A2to sys.path does allow me to import functions from whichever ofgroup_A1's andgroup_A2'smain.pyI choose to import from first, but then for the second one it is impossible to make it look at the second folder; because it has loaded one function from a givenmain.py, seemingly no othermain.py> can be considered.)
Is it preferebale to add init.pys in all folders or can this be done by using importlib ?
Apologies for not creating a re-producible example, I cannot do it I believe for this question.
 
    