Random Dude
Random Dude

Reputation: 3

How to invoke/execute Maya menu item using Python?

I would like to learn how to invoke/trigger a menu bar item in Maya using python.

For example, opening the "content browser" dialog window from menu bar:Windows->General Editors->Content Browser.

Appreciate any hints on this! Thank you!

Upvotes: 0

Views: 782

Answers (1)

haggi krey
haggi krey

Reputation: 1978

If you enable "Echo all commands" in the script editor, you can see which commands are executed if you choose a menu item, in this case it is:

OpenContentBrowser;

So from python you can try it with pymel:

import pymel.core as pm
pm.mel.OpenContentBrowser()

Or with cmds:

import maya.cmds as cmds
cmds.OpenContentBrowser()

Upvotes: 1

Related Questions