Maya Training

Creating characters In Maya and Zbrush

Maya Training

Creating character renders in Maya 2017 and Arnold

Maya Training

Spach-Alspaugh House the complete courseware
You are here > Home > SimplyMaya Community Forums

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 16-03-2008, 11:50 PM   #1
Registered User
Join Date: Jul 2004
Location: Vancouver
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default python call inside mel

How can I pass a Mel string variable into a python call from within a mel script ?

so I want to do something like this ... but this doesn't work:

string $myString;
string $myList = python("myString.split(':')");

Studio where I work cannot move totally to Maya python, but I would like to take advantage of python's string, list, and re methods from within a mel script. I'm wondering if anyone out there has done something similar. I thing I need to precede with another python call to create the python string object named myString .... but still can't get anything to work ...
suzanne is offline   Reply With Quote
Old 17-03-2008, 11:13 PM   #2
Registered User
t1ck135's Avatar
Join Date: May 2004
Location: UK
Posts: 1,991
Thanks: 0
Thanked 0 Times in 0 Posts

Hi suzanne,

I've played about with this in the past and the following should help you on your way. The thing to remember is to make sure the python() call uses double quotes immediately inside it and then to escape any python special characters or quotes.

python("myVar = \"hello\"");
python("print myVar")
will result in the script editor printing hello
Examples of bTraffic - a traffic animation tool for Maya
bFlocking - a tool for Maya 8.5+ to generate flocking and swarming behaviours
Jan/Feb Challenge 2007 Entry and W.I.P
May/Jun Challenge 2006 Entry and W.I.P
Mar/Apr Challenge 2006 Entry and W.I.P
Jan/Feb Challenge 2006 Entry and W.I.P
Nov/Dec Challenge 2005 Entry and W.I.P
Sep/Oct Challenge 2005 Entry and W.I.P
Jul/Aug Challenge 2005 Entry
t1ck135 is offline   Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
MEL headache! happymat27 Members Lounge 5 05-12-2010 09:43 AM
MEL headache!! happymat27 Mel Scripts & Programming 1 03-12-2010 04:41 PM

Thread Tools

A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2017 SimplyMaya - vBulletin® Copyright © 2000-2017, Jelsoft Enterprises Ltd.