How to call functions from external script in current script

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 05 May 2012   #1
How to call functions from external script in current script

I am trying to create a new hair system from a set of existing curves and I am running into this problem:

If I try to call the Maya Command "assignNewHairSystem" from a freshly loaded instance of Maya, then I get the error--"Cannot find procedure "assignNewHairSystem""

However, if I use the menu to create a new hair system, which calls the command "assignNewHairSystem," and then undo the result, I can then call the "assignNewHairSystem" command from my script, no problem.

Running "whatIs" on the command reveals that it is a part of the preInstalled script "DynCreateHairMenu.mel" located at:
C:/Program Files/Autodesk/Maya 2011 Subscription Advantage Pack/scripts/startup/DynCreateHairMenu.mel


How can I access this script and its functions from my script? So that I don't have to manually run this command before running my script, every time I open Maya.


In other languages I am used to calling functions from other libraries by using #include and then the file name.

How is this done in mel?
 
Old 05 May 2012   #2
Thumbs up use the source Luke!

I see...you use the keyword "source" and the script name that contains the global procedure that you want to call.

in this case:

source DynCreateHairMenu;


worked just fine.

aaron
 
Old 05 May 2012   #3
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:11 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.