How do I access the module that is outside the directory? for example, I want to access a function from xyz.py
inside abc.py
which is inside folder X
:
- Project/
-> X -|
|-> abc.py
|-> lmn.py
-> xyz.py
Just writing from xyz import func
or from Project.xyz import func
inside abc.py
doesn't work.
I have also referred to few other solutions and tried to set the path using system, but even that doesn't work:
import sys
sys.path.insert(0,'path/to/Project')
from xyz import func