in reply to require without the exec
For a module, "loading" it will initialize these things and that's all, until you call something else inside it. But for a script, you want to have it execute the lines that set up your data structures, but then stop before doing the "main" code. That could be mixed in, and there is no general way to tell. However, the structure of your script might make it clear: in the simplest case, copy just the top N lines to a temp file and load that.
|
|---|