Loading DotNet Assemblies in Maya

Is there a way to load dotnet assemblies in Maya to be able to call code in them, similar to DotNet in Maxscript?

I’m aware of being able to create C# based plugins for Maya, but I have utilities written in C# and built to DLLs that I’d like to be able to call from Maya via MEL or Python without having to create a Maya plugin.

Not a good idea. Maya doesn’t have anything built-in for that. There are some tricks… but they’re tricks. For real development, use Maya API, c++, OpenMaya, and Python. Everything else is amateurish…

Hmm. Thanks, I didn’t want to have to maintain another C# project but I guess I’m going to have to create the plugin just to be able to call my library.

If the utilities you’ve written in C# are external (ie don’t interact with Maya in any way, change scene state etc) then yes, you can load the DotNet .dll in Python and use it just as you would use a regular Python module. We use this all the time and it’s quite robust once you’re familiar with it.

Look into Pythonnet there are some decent examples to follow.

3 Likes

Oh, I didn’t think to use a python library to do this. Yes, my C# utility is just a folder structure parser so it doesn’t interact with Maya. Thanks, I’ll look into this approach too.