Python searches for modules according to the order specified in the sys.path list and stops searching as soon as it finds a match for the module name. For example, if you have a utility module called myUtils.py stored in two different plug-in directories and these directories contain different code, both plug-ins will reference the same module—the one found first in the sys.path list. You can use Python's package style for storing and referencing your modules to avoid unintentional overwriting of plug-ins or accessing of the wrong module. Start by creating a directory with a detailed name that is unlikely to be duplicated by others, and store your _plugin.py file in that directory. Create another directory of the same name within the first directory, and place your other plug-in files in the newer directory with an empty file named __init__.py, so that the directory structure looks as follows: torqueCalculator torqueCalculator_plugin.py torqueCalculator __init__.py torqueUtils.py torqueForm.py torqueDB.py When you import files in your code, use the package name to qualify the import. For example, inside torqueForm.py, you can qualify the import with the following statement: from torqueCalculator.torqueDB import TorqueDB |