Skip to content

Commit 1b79755

Browse files
Add a pro tip.
1 parent 28f0218 commit 1b79755

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Doc/howto/multiple-interpreters.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,11 @@ contents of the :mod:`__main__` module cannot be reproduced by executing
426426
a script (or module) file. Consequently, calling a function defined
427427
in :mod:`__main__` in these cases will probably fail.
428428

429+
Here's one last tip before we move on. You can avoid the extra
430+
complexity involved with functions (and classes) defined in
431+
:mod:`__main__` by simply not defining them in :mod:`__main__`.
432+
Instead, put them in another module and import them in your script.
433+
429434
Calling Methods and Other Objects in an Interpreter
430435
---------------------------------------------------
431436

0 commit comments

Comments
 (0)