nukeymusic wrote: > How can I load a python-script after starting python in the > interactive mode? > I tried with >>>>load 'myscript.py' >>>>myscript.py >>>>myscript > > but none of these works, so the only way I could work further until > now was copy/paste line per line of my python-script to the > interactive mode prompt > I do know how to run the script non-interactively, but what I want to > do is adding lines to the code I have written thus far in interactive > mode. > > thanks in advance > nukey
Hello, You can make the code in your script available to the interpreter by typing import myscript (assuming that you are running the interpreter in the same directory that contains myscript.py) You can access functions, classes and other top-level objects in your script by prefixing their names with "myscript" and a dot (".") e.g. myscript.myfunc, myscript.MyClass, myscript.myvar You can't really edit your script in the interpreter, but you can edit and save in a text editor and then type reload(myscript) in the interpreter to refresh its version of the myscript code. N.B. when you import/reload your script the interpreter will immediately execute any code that is not enclosed in a function or class definition. Cheers, Kev -- http://mail.python.org/mailman/listinfo/python-list