Created
November 1, 2022 15:27
-
-
Save serafdev/101ab6af47004bdbcb87bb2927e7e705 to your computer and use it in GitHub Desktop.
Relative Paths Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/Code/test via π v3.10.7 | |
β― cat folderA/lib.py | |
def test(): | |
print("Test") | |
~/Code/test via π v3.10.7 | |
β― cat folderB/folderC/folderD/app.py | |
import os, sys | |
sys.path.append(os.path.join(os.path.dirname(__file__), '../../../')) | |
from folderA.lib import test | |
test() | |
~/Code/test via π v3.10.7 | |
β― python folderB/folderC/folderD/app.py | |
Test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or: