Home Technical Talk

mel expressions inside python

Hello I'm wondering is it possible to run mel expressions not through expression editor but inside python script
here is my script:

import maya.cmds as cmds
import maya.mel as mel

def lag(frame, goal, follower, lagAmt):
goalTrans = cmds.getAttr(goal +".translate", t=frame-lagAmt)
goalRot = cmds.getAttr(goal +".rotate", t=frame-lagAmt)
cmds.setAttr(follower+".translate",goalTrans[0][0], goalTrans[0][1], goalTrans[0][2])
cmds.setAttr(follower+".rotate",goalRot[0][0], goalRot[0][1], goalRot[0][2])


and this is the expression which I want to run but it does not work ;/
python("lag(" + frame + ", 'pSphere1', 'pSphere2', 2)")

Thank you!
Sign In or Register to comment.