This article and we share the main is python in the use of reload functions related content, come to see it, hope to learn Python to help you. The reload function uses the module name instead of the variable name, that is, when you change the name, it also loads the original name. When reload is used, the module is recompiled and the new module replaces the original module. If the previous instance created from this module is still implemented using the old module. In particular, names that are loaded with the From-import statement are not updated. Example: # file:builtin-reload-example-1.py fromImpImportReloadImportHelloReload(hello)Reload(hello) output is as follows: = = = restart:d:/work/csdn/python_game1/example/builtin-reload-example-1.py ===hello again, and welcome to The Showhello again, and welcome to the Showhello again, and welcome to the show>>> here helo.py code as follows: print (' Hello AG Ain andWelcome toThe show ') 1. If the module is syntactically correct, but fails during initialization, the import process does not correctly bind the module's name to the symbol table. At this point, the module must be loaded with the import () function before the module can be reloaded. 2. Reloading the module does not delete the original old version of the module in the symbol table of the registration entries. 3. If a module takes advantage of the From ... Import ... Way to import objects from another module, the reload () function does not redefine the imported objects, you can take advantage of the import ... form to avoid this problem. 4. The Reload module that provides the class does not affect any of the saved instances of the provided class---the saved instance will continue to use the original method definition, only the new instance of the class uses the new format. This principle also applies to derived classes. Source: Large slope 3D software development
Using the reload function in Python