Referencing USD variants with Python in Maya

Hey everyone,

I’m trying to reference a USD file in Maya using the cmds.file() command, and it works almost perfectly. Unfortunately, I’m unable to create a reference to a specific prim variant within the USD file.

I know it’s possible to select it when creating a reference manually in the “Reference Editor,” but I’m looking for a way to do this using Python.

Does anyone have any ideas?

If you use the specific Maya usd import command, it has flags you can provide for more control over your inputs

1 Like

Thanks, it’s very helpful. But it’s not 100% what I need. For regular importing, it works perfectly. But I need to reference this USD file, not just import it. I tried to pass the primVariant flag using options in the cmds.file(r=true, options=…) command without any luck.

Hi @Kemote ,

It’s not clear what you need, but maybe this test can give you some ideas on how to accomplish that?