Created
January 8, 2022 23:37
-
-
Save Zenahr/395ecf41d425cac11ac4e87f1d0e82ad to your computer and use it in GitHub Desktop.
Python import "hack" for sibling and parent module imports
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
import sys, os | |
sys.path.insert(0, os.path.abspath('.')) # https://stackoverflow.com/a/9446075/12675239 | |
replace ('.') with whatever directory you'd like to enable imports from. (sibling/parent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment