These statements are intended to initialize the module. They are executed only the first time the module is imported somewhere. Each module has its own private symbol table, which is used as the global symbol table by all functions defined in the module. Thus, the author of a module can use global variables in the module without worrying about accidental clashes with a user's global variables. On the other hand, if you know what you are doing you can touch a module's global variables with the same notation used to refer to its functions, modname.itemname .
Modules can import other modules.
The imported module names are placed in the importing module's global symbol table. There is a variant of the import statement that imports names from a module directly into the importing module's symbol table. This has the same syntax as the shell variable PATH , i.e., a list of directory names. This allows Python programs that know what they're doing to modify or replace the module search path. See the section on Standard Modules later.