The documentation for runpy
warns "…any functions and classes defined by the executed code are not guaranteed to work correctly after a runpy
function has returned." Why is that? If they functioned normally during runpy
execution, what might happen after runpy
returns to make them go awry?
Asked
Active
Viewed 22 times
0

Kodiologist
- 2,984
- 18
- 33
-
1One factor could be that `sys.path`, `sys.argv` and `sys.modules` are modified during execution, then reverted when the function from `runpy` returns: https://docs.python.org/3.11/library/runpy.html – slothrop Jul 16 '23 at 14:17