Digital humans the art of the digital double
Ever wanted to know how digital doubles are created in the movie industry? This course will give you an insight into how it's done.
# 1 01-12-2013 , 09:10 AM
Registered User
Join Date: Dec 2013
Posts: 1

Automatically execute Python-Script when Maya loaded

Hey there,

short but very important question: Is it possible to load and execute a Python-Script after Maya loaded successfully?

With the following code I added another script path: (userSetup.py)
Quote:
import sys
sys.path.append( 'D:/test/' )
syspaths = sys.path
import pythontest
pythontest.sayit()


The content of my script "pythontest.py" is:

Quote:
def sayit():
print 'Hello World!'


After the Maya start I expected the command response "Hello World!" but there is nothing, why? The only thing I want is an automatic execution of a Python-Script after every Maya start.

Thank you for your help I am looking forward!

Andy

# 2 01-12-2013 , 03:04 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Does userSetup.py actually execute on startup or is it just userSetup.mel? If so, you can try wrapping your python code in
Code:
python("command one; command two()");
And put that in userSetup.mel

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads