Can you do this.
Here is an example.
This is the contents of the a.ipy file:
%run b.ipy print(myvar) print(myfunc())
This is the contents of the b.ipy file:
myvar = !echo 1 def myfunc(): tmp_var = !echo 2 return tmp_var
As you can see, b.ipy uses! operator. When you execute a.ipy, you get the following result:
ipython a.ipy ['1'] ['2']
So, you "import" the "modules" not the way you do it in python, but the way you do it in the shell with source .
But I'm not sure if this is right, maybe it is. At least it works and allows you to extract common functions and reuse them from other script files.
source share