Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # you need to set this manually!
- __EXPECTED_PATH__ : str = 'foo.bar'
- if not (TYPE_CHECKING or (__name__ == __EXPECTED_PATH__)):
- # if the script is not inside a module as expected,
- # (such as if `__name__ == '__main__'`)
- # (or if using a type checker)
- # add to the path the directory which contains the package
- sys.path.append(os.path.join(
- sys.path[0],
- '../' \* __EXPECTED_PATH__.count('.'),
- ))
- from foo.stuff import things,otherthings
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement