Maya has a
repeatLast
command, that appears to be undocumented (as of Maya 2016). Here's the interactive help:help repeatLast; // Result: Synopsis: repeatLast [flags] Flags: -e -edit -q -query -ac -addCommand String -acl -addCommandLabel String -cl -commandList Int -cnl -commandNameList Int -hl -historyLimit Int -i -item Int -nhi -numberOfHistoryItems Command Type: Command //You can pass a string to the
addComand
flag. However it only parses mel, not Python. To executePython, you need to jump through some hoops:import pymel.core as pm def doStuff(): print "doing stuff" pm.repeatLast(addCommand="python(\"doStuff()\")", addCommandLabel="doStuff")