Skip to content

Instantly share code, notes, and snippets.

@Zenahr
Created January 8, 2022 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zenahr/395ecf41d425cac11ac4e87f1d0e82ad to your computer and use it in GitHub Desktop.
Save Zenahr/395ecf41d425cac11ac4e87f1d0e82ad to your computer and use it in GitHub Desktop.
Python import "hack" for sibling and parent module imports
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