When and Why to Use “If Name Equals Main” in Maya Scripts

Are you creating Maya scripts with Python? Confused about some conditional statements? Here, Chris discusses what the Python if __name__ == “__main__” means. Additionally, Chris walks through when you would use the Python conditional statement when making Maya scripts. Most important of all, Chris explains why you should use it in scripting work.

Chris Zurbrigg is the creator of some great tools for Maya. Blue Pencil, Keyframe MP, and the Charcoal Editor can all round out your Maya Projects with tools that have much needed finesse. Chris has also given back to the community with great tutorials, particularly getting started with Maya Scripting with Python.

Some of the links on lesterbanks are "affiliate links", a link with a special tracking code. This means if you click on an affiliate link and purchase the item, we will receive an affiliate commission. The price of the item is the same whether it is an affiliate link or not. Regardless, we only recommend products or services we believe will add value to our readers. By using the affiliate links, you are helping support our Website, and we genuinely appreciate your support.