Python -- Importing Modules
Hi! I'm just wondering a bit here. With importing modules in Python, I usually go about it like this when I'm using standard modules:
Code:
#Standard module Code:
~$ Fighting Game/ Code:
import script1b Code:
import script2a Code:
import ..script2b Any help with this? |
If import accepts pathnames, then use proper pathnames:
Code:
bad: import ..script2b |
Code:
script2a = __import__('dir2.script2a',level=1) |
The way I usually do this is with a .pth file and the site module.
dir1/deps.pth Code:
../dir2 Code:
import site As a bonus, you can make this work with pylint so that it finds all of your local dependencies. .pylintrc Code:
[MASTER] |
All times are GMT -5. The time now is 02:47 AM. |