reloadall tester(reloadall reload_all'reloadall 'reloading reloadall reloading types mimic self-test code finallyif you look at the output of tkinter reloads earlieryou may notice that each of the three variants may produce results in different orderthey all depend on namespace dictionary orderingand the last also relies on the order in which items are added to its stack in factunder python the reload order for given reloader can vary from run to run to ensure that all three are reloading the same modules irrespective of the order in which they do sowe can use sets (or sortsto test for order-neutral equality of their printed messages--obtained here by running shell commands with the os popen utility we met in and used in import os res os popen('reloadall py tkinter'read(res os popen('reloadall py tkinter'read(res os popen('reloadall py tkinter'read(res [: 'reloading tkinter\nreloading tkinter constants\nreloading tkinter _fix\nreloadres =res res =res (falsefalseset(res =set(res )set(res =set(res (truetruerun these scriptsstudy their codeand experiment on your own for more insightthese are the sort of importable tools you might want to add to your own source code library watch for similar testing technique in the coverage of class tree listers in where we'll apply it to passed class objects and extend it further also keep in mind that all three variants reload only modules that were loaded with import statements--since names copied with from statements do not cause module to be nested and referenced in the importer' namespacetheir containing module is not reloaded more fundamentallythe transitive reloaders rely on the fact that module reloads update module objects in placesuch that all references to those modules in any scope will see the updated version automatically because they copy names outfrom importers are not updated by reloads--transitive or not--and supporting this may require either source code analysisor customization of the import operation (see for pointerstool impacts like this are perhaps another reason to prefer import to from--which brings us to the end of this and partand the standard set of warnings for this part' topic module gotchas in this sectionwe'll take look at the usual collection of boundary cases that can make life interesting for python beginners some are review hereand few are so obscure advanced module topics