print('done loading 'the first time this module is imported (or run as program)python executes its statements from top to bottom some statements create names in the module' namespace as side effectbut others do actual work while the import is going on for instancethe two print statements in this file execute at import timeimport module starting to load done loading once the module is loadedits scope becomes an attribute namespace in the module object we get back from import we can then access attributes in this namespace by qualifying them with the name of the enclosing modulemodule sys module name module func module klass heresysnamefuncand klass were all assigned while the module' statements were being runso they are attributes after the import we'll talk about classes in part vibut notice the sys attribute--import statements really assign module objects to namesand any type of assignment to name at the top level of file generates module attribute namespace dictionaries__dict__ in factinternallymodule namespaces are stored as dictionary objects these are just normal dictionaries with all the usual methods when needed--for instanceto write tools that list module content generically as we will in --we can access module' namespace dictionary through the module' __dict__ attribute continuing the prior section' example (remember to wrap this in list call in python --it' view object thereand contents may vary outside used here)list(module __dict__ keys()['__loader__''func''klass''__builtins__''__doc__''__file__''__name__''name''__package__''sys''__initializing__''__cached__'the names we assigned in the module file become dictionary keys internallyso some of the names here reflect top-level assignments in our file howeverpython also adds some names in the module' namespace for usfor instance__file__ gives the name module coding basics