I have two projects, each one with a Python folder where I have another folder named lib_py with some shared libraries Python files. Note that even lib_py is a set of shared libraries, each project can have older/newer version of lib_py files (basing on its needs). So that's why each project needs to have its lib_py folder. The hierarchy is like following:
Project1
Python
lib_py
__init__.py
example.py
main
main.py
Project2
Python
lib_py
__init__.py
example.py
main
main.py
In both main.py of two projects, example.py is imported as follow:
from lib_py.example import x
In order each main.py has access to example.py, I append two following paths in my sys.paths:
D:\Project1\Python
D:\Project2\Python
The problem happens here: main.py from Project1 is called, the good example.py is used but when right after calling main.py from Project1, main.py from Project2 is called, again example.py from Project1 is called although I expect that example.py from Project2 is used.
Is there any way to precise that which package should be used if several are found with same names? Is there any other solution in your opinion? (without changing directory hierarchies of-course)
Thanks