This is a bare bones bit of code. The main class is the
ModuleManager, which can find any
.mod files on the MAYA_MODULE_PATH of the current Maya environment. It’s primary use is to find and list all the modules; secondarily it can be used to toggle them on and off (by changing the leading + which Maya uses to id a module to a -, or vice-versa). It’s pretty dumb (no accounting for file permissions, incorrectly formatted .mod files, etc) but it’s handy for quickly testing out configs.
Also included is a GUI class,
ModuleManagerDialog, which finds provides a simple GUI for listing, enabling, and disabling .mod files. Again, pretty simple stuff, but people may find it useful.
As will all code I put up here, it’s MIT licensed. Use away with attribution - and if you have any bug fixes, let me know and we’ll fix the Gist version.
PS, hat tip to the gang at TAO for the idea of using a context manager to get out of all those stupid setParent(“..”) calls in Maya GUI work. I could not find the original post where somebody mentioned it - but whoever you are, sir or madam, thank you ever so much.