Creating a Python plugin for Maya

Creating a Python plugin for Maya

aaron_strasbourgUMPQ3
Explorer Explorer
1,433 Views
2 Replies
Message 1 of 3

Creating a Python plugin for Maya

aaron_strasbourgUMPQ3
Explorer
Explorer

I'm trying to create a plugin for Maya. The plugin is written in Python and has multiple module dependencies in the "scripts" directory of the main plugin directory. The .mod file is in the main plugin directory as well, and it properly shows up in the Maya plugin window. The directories are setup matching the documentation.


When loading the plugin, it has a lot of issues regarding imports. I have went over Autodesk documentation for days and I cannot get a test case that works with multiple Python modules.

Would someone be able to setup an example case with a Python plugin that loads and unloads from the main plugin file, but contains the majority of the plugin "core" files in the scripts directory?

For example, I want "core.py" to be running the show:
-example_plugin
--icons
--plug-ins
---example_plugin.py
--scripts
---core.py
---ui.py
---utilities.py
--example_plugun.mod

"example_plugin.py" is the plugin that is loaded. It could have a menu or buttons added etc but these buttons would just start an instance of "core.py" which would control the entire tool.

This is how I've seen lots of plugins work before but when it comes to making one, nothing seems to work for me. It might be an easy solve but a simple test case example would be extremely helpful.

Thank you in advance!

1,434 Views
2 Replies
Replies (2)
Message 2 of 3

JeffHeat
Explorer
Explorer

Hey, yes there is an easy way to do this, you just need to make sure your .mod file is set up properly and that all of your imports are set up correctly on your plugin and script .py files.  Can you share the .mod file?

0 Likes
Message 3 of 3

JeffHeat
Explorer
Explorer
Sorry I also see another issue. In my experience your .mod file needs to be in the same directory as the root folder of your plugin. So rather than .mod be in the folder "example_plugin", they should both be in the same parent folder, if that makes sense.
0 Likes