Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sanix-Darker/c3fa4fae8f2994e1491823bd48badcae to your computer and use it in GitHub Desktop.
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)
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