Closed bobbyyan0 closed 4 years ago
https://chrisyeh96.github.io/2017/08/08/definitive-guide-python-imports.html#case-3-syspath-could-change-take-2
Folder structure:
. ├── packA │ ├── a1.py │ ├── a2.py │ └── subA │ └── sa2.py └── start.py
start.py:
import packA.a2 print('start.py')
a1.py:
import packA.a2 print('a1.py')
a2.py:
import packA.subA.sa2 print('a2.py')
sa2.py:
print('sa2.py')
Result in the parent directory of packA and start.py:
> python start.py sa2.py a2.py start.py > python -m packA.a1 sa2.py a2.py a1.py
Python 3.7.7
Good catch. In retrospect, I'm not sure why I thought this case ("Case 3") was different from the previous case ("Case 2"). I will replace "Case 3" with the current "Case 4".
Closed by commit f81e2d2.
https://chrisyeh96.github.io/2017/08/08/definitive-guide-python-imports.html#case-3-syspath-could-change-take-2
Folder structure:
start.py:
a1.py:
a2.py:
sa2.py:
Result in the parent directory of packA and start.py:
Python 3.7.7