recur py from recur import from recur import run recur now if it doesn' exist ok"xalready assigned error"ynot yet assigned :\codepy - import recur traceback (most recent call last)file ""line in file \recur py"line in import recur file \recur py"line in from recur import importerrorcannot import name python avoids rerunning recur ' statements when they are imported recursively from recur (otherwise the imports would send the script into an infinite loop that might require ctrl- solution or worse)but recur ' namespace is incomplete when it' imported by recur the solutiondon' use from in recursive imports (noreally!python won' get stuck in cycle if you dobut your programs will once again be dependent on the order of the statements in the modules in factthere are two ways out of this gotchayou can usually eliminate import cycles like this by careful design--maximizing cohesion and minimizing coupling are good first steps if you can' break the cycles completelypostpone module name accesses by using import and attribute qualification (instead of from and direct names)or by running your froms either inside functions (instead of at the top level of the moduleor near the bottom of your file to defer their execution there is additional perspective on this issue in the exercises at the end of this --which we've officially reached summary this surveyed some more advanced module-related concepts we studied data hiding techniquesenabling new language features with the __future__ modulethe __name__ usage mode variabletransitive reloadsimporting by name stringsand more we also explored and summarized module design issueswrote some more substantial programsand looked at common mistakes related to modules to help you avoid them in your code the next begins our look at python' class--its object-oriented programming tool much of what we've covered in the last few will apply theretooclasses live in modules and are namespaces as wellbut they add an extra component to attribute lookup called inheritance search as this is the last in this part of the advanced module topics