Thanks, understand and make sense! For instance I would like to have the
% load_ext autoreload % autoreload 2 called automatically whenever I start/restart an ipython shell. Another use case is to call other script from one script emulating the run magic % run myScript.py or % run -i myScript.py Buy Dietrich Il giorno martedì 27 settembre 2016 21:52:22 UTC+2, Almar Klein ha scritto: > > No, its not possible to use magics in the script. This is deliberate, > since it would be invalid Python. Not sure why the use of the ipython API > calls would not work. Pyzo’s IPython shell is not completely a proper > IPython shell, so it might be that we don’t do enough for this to be picked > up somehow… > > > > What is the problem that you’re trying to fix, or workflow that you’re > trying to achieve? Maybe there are other ways to make it work. > > > > - Almar > > > > > > > > *From: *Dietrich Pescoller <javascript:> > *Sent: *27 September 2016 18:22 > *To: *Pyzo <javascript:> > *Subject: *[Pyzo] how to execute python magics from script > > > > Is there a way to execute ipython magics from script in IEP. > In particular I'm interested in startup script > > I tired something like this: > > from IPython import get_ipython > > get_ipython().magic('load_ext autoreload') > > get_ipython().magic('autoreload 2') > > > > Which works in a standard ipython console but does not work when using IEP. > > > > Any suggestion would be apprecieated > > Thanks, > Dietrich > > -- > You received this message because you are subscribed to the Google Groups > "Pyzo" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pyzo+uns...@googlegroups.com <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > > -- You received this message because you are subscribed to the Google Groups "Pyzo" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.