MEL with Python with MEL

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 2013   #1
MEL with Python with MEL

I'm trying to pass a variable from MEL into a Python function... something along these lines:


$var = 1;
python("import myFile")
python("myFile.myFunc(" + $var + ")");


...but that doesn't seem to work. Any idea on how to make this work or whether maybe this is not at all possible.
__________________
// Fredrik
 
Old 05 May 2013   #2
Originally Posted by fr3drik: I'm trying to pass a variable from MEL into a Python function... something along these lines:


$var = 1;
python("import myFile")
python("myFile.myFunc(" + $var + ")");


...but that doesn't seem to work. Any idea on how to make this work or whether maybe this is not at all possible.


Is this for expression? I know it sound stupid but if it is then you forget the ";" in the 2nd line xD.If its for expression I dont think you need to import your module every time so try to import it in the script editor and then use it. If you want please post the error as well,because I dont see any other problems with it :>.
__________________
Maya Fluids own xD.
Graduate showreel:vimeo.com/64879738 xD
 
Old 05 May 2013   #3
I forgot the semicolon when typing this into the CGTalk textbox... but I also made another mistake, and so now it is all working fine. This is the correct syntax:

Thanks.

$var = 1;
python("import myFile");
python("myFile.myFunc(\"" + $var + "\")");
__________________
// Fredrik
 
Old 05 May 2013   #4
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.
 
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 07:08 PM.


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