Overwriting plug-ins

Upon startup, Abaqus/CAE searches for plug-ins in the Abaqus/CAE installation, your home directory, the current directory, and the directory specified by the plugin_central_dir Abaqus environment parameter. If Abaqus/CAE finds a plug-in with the same name and case in multiple directories, the plug-in found later in the search will overwrite one found earlier in the search. Plug-in names are case sensitive. For example, a plug-in named myPlugin is different from a plug-in named MyPlugin. The overwriting approach enables you to use a customized version of a plug-in that resides only in your home directory or current directory; however, in most cases you should avoid naming conflicts with plug-ins.

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