[IPython-User] [IPython-user] using magic command inside the loop

unit e_redekop@yahoo....
Tue Dec 28 14:52:15 CST 2010

Hi all,

So, I want to use %run inside a for loop in my script.py to call for another
Something like this:

#beginning of script.py
import IPython
ip = IPython.ipapi.get()
for i in range(0,5):
          ip.magic('%run script_1.py')
#end of the script.py

However, when I execute script.py in my IPython shell, I get: "NameError:
name 'ip' is not defined"

My question is this: how come ip is not defined inside the for scope is I
just defined it before entering the loop?

Thank you very much for answering. 
View this message in context: http://old.nabble.com/using-magic-command-inside-the-loop-tp30547307p30547307.html
Sent from the IPython - User mailing list archive at Nabble.com.

More information about the IPython-User mailing list