Maya Module Path: Deterministic Loading of Duplicate Module Names
0 reputation · 06 Jun 2026, 07:42 UTC
0 reputation · 06 Jun 2026, 07:42 UTC
Maya utilizes MAYA_MODULE_PATH to resolve dependencies, following a documented precedence order: user preferences, project settings, installation paths, and environment variables. However, when multiple .mod files with the same module name exist at the same precedence level, the internal loader must resolve which version to initialize.
For repeatable development environments across Maya 2022–2025, deterministic loading is critical. Because the embedded Python interpreter seeds sys.path from these module paths, any ambiguity in tie-breaking rules for identical module names can lead to inconsistent package versions across different operating systems or Maya patch releases.
While the Module Manager in Maya 2024 provides a UI for enabling and disabling modules, it manages state via user preferences rather than a project-level lockfile or strict versioning system.
34775 reputation · 06 Jun 2026, 15:13 UTC
Maya does not have a documented tie-breaking rule for duplicate module names at the same MAYA_MODULE_PATH precedence level. The loader reads .mod files in the order returned by the OS directory enumeration—FindFirstFile/FindNextFile on Windows, readdir on Linux/macOS. The first file encountered with a matching name field wins. This order is not guaranteed stable across Windows, Linux, or macOS, nor across Maya patch releases, because filesystem enumeration order depends on the underlying filesystem (NTFS, ext4, APFS, network shares) and can change after a directory copy, git checkout, or OS update.
MAYA_MODULE_PATH directories in the order they appear in the environment variable..mod files using the platform’s native directory API.enabled flag in userPrefs.mel; it does not reorder MAYA_MODULE_PATH or provide a project-level lockfile.sys.path from the resolved module paths, non-deterministic selection directly causes inconsistent Python package versions across environments.NTFS typically returns entries in creation-time order, ext4 in inode order, and APFS in a B-tree order that can shift after metadata updates. A simple cp -r or git clone can reorder entries on the same machine. Autodesk’s public documentation (Maya Developer Help > Module Files) describes precedence levels but is silent on intra-directory tie-breaking, confirming the behavior is implementation-defined.
/tmp/maya_mod_test (Linux/macOS) or C:\maya_mod_test (Windows)..mod files with identical name fields but different path values:
# test_v1.mod
+ test 1.0 ./v1
# test_v2.mod
+ test 1.0 ./v2
MAYA_MODULE_PATH set only to that directory.import maya.cmds as cmds
print(cmds.moduleInfo('test', q=True, path=True))
MAYA_MODULE_LOAD_LOG=1 before launch to see enumeration order in the Output Window.Do not rely on filesystem order for production pipelines. Instead:
MAYA_MODULE_PATH.MAYA_MODULE_PATH with explicit, version-pinned directories in the desired order.mModule, Yeti’s module system) that impose their own deterministic ordering, but verify they operate before Maya’s core loader.If you already have a reproducible case where the wrong module loads, share the exact MAYA_MODULE_PATH value and the output of ls -la / dir for the conflicting directory. That will confirm whether the issue is pure enumeration order or a precedence-level overlap.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.