Question

I'm getting an error message quoting that I have a syntax error when trying to load my functions. I can load them one at a time into the IDLE, but when pasting the full script, an error is returned. I believe its to do with the second function calling the first. To test this, the simple code below also returns this error :(.

def hello():
    print('Hello there!')

def boo():
    hello()

I'm unsure why this happens because the first function is defined before its called in the second. So it should be loaded in memory already shouldn't it?

Thanks for any help you can give. :)

Was it helpful?

Solution

IDLE interactive interpreter can only handle one task at once, you can't do more.

Save the script to a python file (.py extension), and run it.

From the command line:

$ cd /script_path
$ python script_name.py

Or if you want to run it in IDLE:

Ctrl+N - Paste the code - Save - Press F5

Hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top