Last active
October 11, 2019 12:33
-
-
Save Sanix-Darker/c3fa4fae8f2994e1491823bd48badcae to your computer and use it in GitHub Desktop.
[PYTHON]import a module on sup folder PYTHON withouth been a package (containing a __init__.py file)
This file contains 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
from os import path as ospath | |
from sys import path as syspath | |
# moving the path outside of the current dir | |
syspath.insert(1, ospath.join(syspath[0], '..')) | |
import module | |
# Or just in a specific parent directory in the sup folder: | |
# import sys | |
# sys.path.insert(0, '../module/') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment