In a folder trying to import from another folder at the same level
example
=========
| -- module1/
| | -- sample1.py
|
| -- module2/
| | -- sample2.py
- Trying to import into
sample1.py
fromsample2.py
- Add this to the top of the
sample1.py
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))