Thursday, January 14, 2016

Python Equivalent of mel whatIs command

A common Maya debug for any mel script in All of Maya is the mel whatIs command. It basically tells you the location of any sourced script on your computers file system. It's a great way to melSteal and figure out what a script is doing.  

for mel you just use whatIs and the name of the command

whatIs BuildDisplayMenu;
// Result: Script found in: C:/Program Files/Autodesk/Maya2015/scripts/startup/buildDisplayMenu.mel // 

whatIs duplicate;
// Result: Command // 

if the command is not a script, but an internal maya command it will return "command".

Then you can use the help or help -doc to look up that command in the maya help reference.


 In python the equivalent to mel whatIs is to envoke its __file__ command.

so if not already imported. use the python import command

import mysteryScript

and then run it's __file__

mysteryScript.__file__

and it should return the scripts file path

C:\Program Files\Autodesk\Maya2016\Python\Lib\site-packages\maya\mysteryScript.py 







No comments:

Post a Comment