API Guide > Distributing Maya Plug-ins >

# Distributing Multi-File Modules

All but the simplest of Maya add-ons involve more than one file. For example, a fully implemented render utility node will have at least three files:

- the plug-in file containing the node;
- an Attribute Editor script;
- an icon to represent the node in the Create Render Node dialog.

Each of these files must go into a different directory on the target system. Even with just three files, having the user or site-administrator install them separately, by hand, can be an unwanted burden, and that burden will only grow with the number of files involved, as will opportunities for mistakes.

To simplify multi-file distribution, Maya provides the ability to package them into modules.

About modules

A module consists of a root directory which contains the following sub-directories:

- icons,
- plug-ins,
- presets,
- scripts,
- and a module description file.

When creating the module you place your icons in the icons subdirectory, your C++ and Python plug-ins in the plug-ins subdirectory, your presets in the presets subdirectory (same structure as Maya's presets directory) and your MEL and Python scripts in the scripts subdirectory.

You can override any of these directory structures using the following syntax: <folder to override>:<new location for this folder>. See Module folder structure for more information.

In the module's root directory, place a copy of the module description file with the fourth field set to a suggested path. Distribution simply involves providing the user with a copy of the directory tree, possibly in compressed form.

Module description file

The module description file contains a single line of text with four base fields, separated by blanks:

- A plus-sign (+), which indicates that the module is being added to Maya.
- The name of your module (no spaces allowed).
- The version number of your module (no spaces allowed).
- The path to the root directory of the module (spaces allowed).

For example, if version 1.3 of myModule is installed in /opt/MyCompany/myModule, then the module file would contain the following line of text.

    + myModule 1.3 /opt/MyCompany/myModule

Conditions can also be added before the module name, for example:

+ (Conditions ) “moduleName” “moduleVersion” “moduleLocation”

The conditions can be one of the following.

- MAYAVERSION:
- PLATFORM:
- LOCALE:

See Specifying the conditions for loading the module for more information.

Installing the module

Individual users wishing to install the module would do the following:

1. Uncompress the distribution, if necessary.
2. Move or copy the module's entire directory tree to wherever they want to keep it.
3. Change the fourth field of the module description file to contain the full path to the module's directory tree.
4. Place a copy of the modified module description file into one of the directories in their MAYA_MODULE_PATH environment variable.

Site administrators wishing to install a common copy of the module for multiple users would follow a similar set of steps:

1. Uncompress the distribution, if necessary.
2. Move or copy the module's entire directory tree to a directory which is accessible to all users, such as a network drive.
3. Change the fourth field of the module description file to contain the full path to the module's directory tree.
4. Place a copy of the modified module description file into a common directory which all users have in their MAYA_MODULE_PATH environment variables.

There are three approaches to doing this which are identical to those discussed for the MAYA_PLUG_IN_PATH variable in Distributing individual files. When Maya starts up, it will read in the module description file and add the module's icons directory to its XBMLANGPATH, add the module's plug-ins directory to its MAYA_PLUG_IN_PATH, add the module's presets directory to its MAYA_PRESET_PATH and add the module's scripts directory to its MAYA_SCRIPT_PATH and PYTHON_PATH.