Hi all, When you call something from a menu, it is added to a Recent Command List accessible via the Edit menu. Likewise, when you execute a line in the script editor, the full contents of what you ran is added to said list.
The last entry in that list is repeated on pressing G, or going Edit -> Repeat … However, when running something outside of a menu or Script Editor, this doesn’t happen. from Qt import QtWidgets def onclick(): cmds.polyCube() button = QtWidgets.QPushButton("Press Me") button.show() button.clicked.connect(onclick) Here, a new cube is created on pressing the button, but on hitting G what you get instead is a new button; as it is repeating the script itself rather than what happened on pressing the button. How can I make the contents of onclick trigger on hitting G or pressing Edit -> Repeat …? I’ve tried cmds.evalDeferred("cmds.polyCube()") which I figured would do the job for me, but doesn’t. Like wise with maya.utils.executeDeferred. Then I figured I need a custom command plug-in, but then realised polyCube is also a command and Maya doesn’t care either way. My next/last resort is creating a new but hidden Maya menu, adding a command to it and triggering that so as to force Maya into adding it to the list, and then deleting it. But would love to avoid that. Any ideas? -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCrODZ-1ZM_J-K2uFHYB3VpkBynFzyVkgvgDpcKmewt%2BQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.