Skip to content

Usersetup

Any file named usersetup.py will be run by Maya Python interpreter on Maya startup.

How it works

It loops over all the paths and calls exec on any usersetup.py files it finds.

Cons

Startup exceptions

Since there isn’t any error handling, any errors in usersetup will prevent any other usersetups from loading.

If you use Maya modules with usersetup, and one of them fails, other modules might fail to load.

  • TODO create a sample

AFAIK startup code in |Maya plugins is cleaner, and doesn’t run into this issue. The affected plugin is simply disabled.

Messy environment

Often tools rely on editing the usersetup in Documents/Maya/scripts. This is not recommended, because it might clash with other tools.

E.g. an outsource studio who works for 2 clients installs your tools, which overwrite the usersetup.py from the other studio.

Security risk flagging

Since Maya 2022+, running userSetup.py on startup can be disabled. Or you might get a popup asking for confirmation if you want to run it.
AFAIK plugins do not have this issue.

Maya run on startup

  • Maya module
    • If you have a maya module, it can have its own usersetup file (mel or python) that should excute after the main ones
  • Maya run on startup
    • usersetup in Maya install folder, documents, or in a module
  • Maya ApplicationPackage startup code
    • hey i remember there was a discussion of some very niche way to execute maya (or was it max) startup code.
      believe @theodox or @bob.w mentioned it. might have been related to how maya handles translation? if anyone can point me in the right direction :pray: