I want to do something like the following:
In[1]: name = \'long_name_to_type_every_now_and_then.py\' In[2]: %run name
but this actually tr
Use get_ipython() to get a reference to the current InteractiveShell, then call the magic() method:
get_ipython()
magic()
In [1]: ipy = get_ipython() In [2]: ipy.magic("run foo.py") ERROR: File `u'foo.py'` not found.
Edit See minrk's answer — that's a much better way to do it.