Where to "import"?

Matimus mccredie at gmail.com
Thu Mar 8 21:01:41 CET 2007


> both using os module where should I put the "import os"? In both files?

You don't really have a choice, you have to import os in both files.
Python will only load the os module into memory once, but the import
statements are needed to add the os module to the c and m module
namespaces. The code in c.py cannot 'see' the code in m.py, even if it
was imported by m.py. The import command is not like #include in C, it
is not a code dump.

-m




More information about the Python-list mailing list