79168034

Date: 2024-11-07 20:53:40
Score: 1
Natty:
Report link

I agree with user707650's general guidance, but you can do what you wanted by:

Your idea didn't work because the interpreter creates a new namespace that's local to the function being executed... so your imports are imported in that namespace, but its separate from yours and furthermore is immediately terminated when the function is complete. You won't ever get anything out from a function apart from whatever's listed in the return statement.

In other words, this must be done by executing an import statement, not executing a function.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): user707650
  • Low reputation (1):
Posted by: Mitchell Miller