DEV Community

tp1050
tp1050

Posted on

In order to update PYTHONPATH on the fly

PRE-RUN:
import os
user_home = os.environ["HOME"]

os.environ["PYTHONPATH"] = "..."

BUT IN THE MIDLE OF RUNNING THE SCRIPT ONLY THis:

sys.path.insert(0, '/path/to/whatever')

Discussion (0)