I want to import a module that is not in the Python's search path. I can think of two ways none of which are appealing to me:
- add this to the python file
import sys; sys.path.append("/path/to/mymodule"); import mymodule
- update python path when running the python script
PYTHONPATH=$PYTHONPATH:/path/to/mymodule python myfile.py
Is there any better/cleaner way to do this? If not, which one is preferred?