Anil
Sent from my iPhone
In [29]: globals()['x']
Out[29]: 4
shows that the globals dictionary has the key 'x'. I'm thinking that I
could pass the globals dictionary, then extract x from that. This
requires myscript being a function, but at least I can pass all values
in one shot. To that end, I create myscript.py
~~~~~~~~ myscript.py ~~~~~~~~~~~
def main(ipython_globals):
globals().update(ipython_globals)
print x
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Then from iPython
In [13]: x = 123
In [14]: myscript.main(globals())
123
So it works.
-Ian
--
- Ian
-Ian
--
- Ian