I have a script test.py
and I want it to execute another script this_other_script.py
which will return a list object. test.py
looks like:
if __name__ == '__main__':
someValue = this_other_script
print(len(someValue))
this_other_script.py
looks like:
if __name__ == '__main__':
data = [a,b,c,d]
return(data)
When I run test.py
I receive an error of SyntaxError: 'return' outside function
.
If this is due to program scope I would have thought it would be OK for the calling program to be given a return value from a program it is calling. I wouldn't expect for this_other_script
to access a value of a variable not given to it by test.py
so I'm not sure why this error is displayed.