Running python script inside ipython

Tyler Durden picture Tyler Durden · Jul 31, 2012 · Viewed 174.5k times · Source

Is it possible to run a python script (not module) from inside ipython without indicating its path? I tried to set PYTHONPATH but it seems to work only for modules. I would like to execute

%run my_script.py

without being in the directory containing the file.

Answer

rakke picture rakke · Mar 12, 2015

from within the directory of "my_script.py" you can simply do:

%run ./my_script.py