import simple simple spam change attribute in module just fetches already loaded module code wasn' rerunattribute unchanged of coursesometimes you really want module' code to be rerun on subsequent import we'll see how to do this with python' reload function later in this import and from are assignments just like defimport and from are executable statementsnot compile-time declarations they may be nested in if teststo select among optionsappear in function defsto be loaded only on calls (subject to the preceding note)be used in try statementsto provide defaultsand so on they are not resolved or run until python reaches them while executing your program in other wordsimported modules and names are not available until their associated import or from statements run changing mutables in modules alsolike defthe import and from are implicit assignmentsimport assigns an entire module object to single name from assigns one or more names to objects of the same names in another module all the things we've already discussed about assignment apply to module accesstoo for instancenames copied with from become references to shared objectsas with function argumentsreassigning copied name has no effect on the module from which it was copiedbut changing shared mutable object through copied name can also change it in the module from which it was imported to illustrateconsider the following filesmall pyx [ when importing with fromwe copy names to the importer' scope that initially share objects referenced by the module' namespython from small import xy [ copy two names out changes local only changes shared mutable in place herex is not shared mutable objectbut is the names in the importer and the importee both reference the same list objectso changing it from one place changes it in the otherimport small small small [ get module name (from doesn'tsmall' is not my but we share changed mutable module usage