Importing Other Modules

Index of All Documentation » Wing Pro Reference Manual » Scripting and Extending Wing » Script Syntax »


Scripts can import other modules, including of course wingapi, but also Python's standard library, and even modules from Wing's internals.

However, because of the way in which Wing loads scripts, users should generally avoid importing one script module into another. If this is done, the module loaded by the import will not be the same as the one loaded by the scripting manager, and two entries in sys.modules will result. This happens because Wing uniquifies the module name internally to prevent conflicts between different like-named script modules and/or Wing's internals.

In practice, this is only a problem if data at the top level of the script module is shared in some significant way, so that two loaded copies of the module would be a problem. Be sure to completely understand how modules and import work in Python before importing one script module into another.