pythonpython-3.xwing-ide

Why can't I run my codes in Python Shell?


def thisisfun(x,y,z):
    x=2
    y=3
    z=4 
    print('AHHHHA')
thisisfun(333,"annoy",2142125)

If it is with the last line, then after I clicked on Execute Current File it actually prints AHHHHA But when I attempted to have thisisfun(333,"annoy",2142125) in Python Shell (without the last line), it says name 'thisisfun' is not defined I dont know what happened to my WingIDE...:( Help..


Solution

  • Execute Current File runs that file outside of the debugger until it terminates. This does not happen in the context of the Python Shell's runtime environment, but in a separate process. If you want to work with this in the Python Shell then use Evaluate File in Python Shell in the Source menu. After that, thisisfun is defined in the Python Shell's environment until you restart it from its Options menu.