executing python at runtime


I was wondering if anyone could help me work out how to execute functions in python during runtime…(so I can tweak game play etc…on the fly).

I am using a python IDE called PyScripter and I am executing the script with the -i command line parameter. However when I try and execute a function in the python console …nothing appears to happen.

I feel that I may be missing some setting in panda to allow runtime interpreting of python code.

Any and all help is appreciated.

Kind Regards

I don’T quite understand your question.
Do you mean running the interactive python console while executing code from a p3d package?
Or starting a panda window from the interactive console?
Or… I don’t know.

With “functions” do you mean arbitary functions as in

def doSomething():
    print "hey"


And what exactly do you mean by “runtime”? The panda3d runtime, which runs p3d files or runtime as in state of python, or maybe as in “while panda3d is running”?

I am sorry if the question seemed unclear, please let me try again and clarify the question.

Yes, I want to run the interactive python console while executing the p3d package. The example you have given for a function is the sort of thing I want to execute…either as a method of an instance or a stand alone function. Either way I just want to be able to change in-game behaviors etc while Panda3d is running. eg. I want to use this so i can tweak AI behaviors while the game is running.

I hope this helps. Thank again for any help offered.

Regards Sam

I think what you want is an interactive console.
That is a small window to type commands in while your
game is running without having to break execution.

[InteractiveConsole (irc support & code completion))

Other interactive consoles have been posted to the forum before. Try searching for console.