[IPython-user] Using IPython magic commands in a script to be run in IPython

Gael Varoquaux gael.varoquaux@normalesup....
Mon Feb 15 12:27:13 CST 2010


On Mon, Feb 15, 2010 at 03:14:29PM +0000, Brendan Arnold wrote:
> I want to run a script which executes the IPython %run command to set
> up an environment (like a lightweight import) before I work in
> IPython. This will only ever be run itself from an IPython interpreter
> using %run.

> How do I do this?

Name your file 'foo.ipy', and you the '%magic' syntax in the file. The
code will be executed as if it was typed from the keyboard when you
'%run' it.

Gaël


More information about the IPython-user mailing list