Hello,
I have written a python script with methods in it. Now I want to use methods from that script in ipython. How do I import it for use in ipython?
Cheers
Hello,
I have written a python script with methods in it. Now I want to use methods from that script in ipython. How do I import it for use in ipython?
Cheers
If the file with your functions in it is called mod.py, just:
>>> import mod
>>> mod.myfunction()
Inside IPython:
cd folder/containing/module
import module
module.function(1, 2, 3)
There are several options and all of them work with specific advantages and disadvantages:
from module import *
import module
%edit module.py