Maya: userSetup – execute commands whenever Maya startsup

Hello All,

I was setting up userSetup the mel edition in my company and I instantly realized it was not a trivial task. And the below video covers most of the heavy duty, please check it out.

Since the world has moved on to Python, we should have an example of python as well. Maya docs was kind enough for not giving any info on either of them(Well you’ll get my rant once you watch the above video lol).

Maya userSetup.mel ticket

to check the path from userSetup.mel is being executed

whatIs userSetup.mel
// Result: Script found in: C:/Users/ADMIN/OneDrive/Documents/maya/2020/scripts/userSetup.mel // 

whatIs command wont help in finding userSetup.py

#command can help you find yours scripts directory
print cmds.internalVar(userAppDir=True)

#save below script in userSetup.py to the path that you get from above command.
import maya.cmds as cmds
def dosomething():
    cmds.grid(spacing=100)
cmds.evalDeferred('dosomething()')
print("this is a test")

Maya userSetup.py – where to place the file?

In windows 10 – “C:\Users\ADMIN\OneDrive\Documents\maya\2020\scripts\userSetup.py”

grid spacing changed to 100

Give it a try.

Leave a comment