in the first examplethe name module serves two different purposes--it identifies an external file to be loadedand it becomes variable in the scriptwhich references the module object after the file is loadedimport module module printer('hello world!'hello worldget module as whole (one or morequalify to get names the import statement simply lists one or more names of modules to loadseparated by commas because it gives name that refers to the whole module objectwe must go through the module name to fetch its attributes ( module printerthe from statement by contrastbecause from copies specific names from one file over to another scopeit allows us to use the copied names directly in the script without going through the module ( printer)from module import printer printer('hello world!'hello worldcopy out variable (one or moreno need to qualify name this form of from allows us to list one or more names to be copied outseparated by commas hereit has the same effect as the prior examplebut because the imported name is copied into the scope where the from statement appearsusing that name in the script requires less typing--we can use it directly instead of naming the enclosing module in factwe mustfrom doesn' assign the name of the module itself as you'll see in more detail laterthe from statement is really just minor extension to the import statement--it imports the module file as usual (running the full three-step procedure of the preceding but adds an extra step that copies one or more names (not objectsout of the file the entire file is loadedbut you're given names for more direct access to its parts the from statement finallythe next example uses special form of fromwhen we use instead of specific nameswe get copies of all names assigned at the top level of the referenced module here againwe can then use the copied name printer in our script without going through the module namefrom module import printer('hello world!'hello worldcopy out _all_ variables technicallyboth import and from statements invoke the same import operationthe from form simply adds an extra step that copies all the names in the module into the importing scope it essentially collapses one module' namespace into anotheragainmodule usage