[IPython-dev] magic and imports on engines

Glen W. Mabey Glen.Mabey at swri.org
Tue May 15 14:12:08 EDT 2007


On Tue, May 15, 2007 at 07:18:06PM +0200, Ondrej Marsalek wrote:
> well, i still have this problem with the import of a module or package
> in the current directory. it works in ipython and vanilla python. it
> does not work on the engines, as i said before. i would like to use my
> own extensions, so this is quite important.

Here's what I do to import modules from the current directory into
ipengines:

    ipy1_remote_controller.executeAll( 'import site' )
    ipy1_remote_controller.executeAll( 'site.addsitedir( ' + `os.getcwd()` + ' )' )
    ipy1_remote_controller.executeAll( 'import themodule; reload( themodule )' )

The reload is important so that if you modify the code, the most recent
version gets used.

Glen




More information about the IPython-dev mailing list