Commit e200c0b6f7f12006d43ad63f49467644911780f1
1 parent
65cfb375ff
Exists in
master
Now we can import relatively to the executed module even if we use -m option of python command
Showing 2 changed files with 12 additions and 1 deletions Side-by-side Diff
volia/__init__.py
1 | +""" Just a simple way to import relative modules when calling | |
2 | + modules with the option -m | |
3 | + exemple : python -m volia.script | |
4 | + if script import a module in the same namespace | |
5 | + this will not work because python will try to | |
6 | + find a module in the directory of execution, not those of the | |
7 | + module file. | |
8 | +""" | |
9 | +import sys | |
10 | +import os | |
11 | +sys.path.append(os.path.dirname(__file__)) |