You could use the string form in this case, and make sure your callback is globally executable. That means either the function you use is in Maya's main namespace or you use something self contained
"import myPackage; myPackage.run()" On Tue, 8 Dec 2015 6:06 AM Ben Hearn <[email protected]> wrote: > Hello all, > > I have another query about Maya menus. You can pin them to the shelf which > is great but what gets pinned is the callback which appears to be a memory > address. When Maya is closed and re-opened the callback no longer works. > > I am invoking my commands like so: > > def addMenuItem(parentMenu=None, labelName='', callback=None, sub=False, > tearable=False): > if callback == None: > newMenu = pm.menuItem(parent=parentMenu, label=labelName, > subMenu=sub, tearOff=tearable) > return newMenu > else: > pm.menuItem(p=parentMenu, label=labelName, > command=pm.Callback(callback)) > > > Is there a better way to pin our menu items i.e. pin the script itself or > would that be based around the command being something other that > pm.Callback? > > Cheers, > > Ben > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAM2ybkW63EmZ6%3DY-GZaxCMKOVXinu5LeqBmjNod-497rv-gpCQ%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAM2ybkW63EmZ6%3DY-GZaxCMKOVXinu5LeqBmjNod-497rv-gpCQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA392JdwRRXujn4eQgjBXaGUWotfkfSabqWUhkpPUH9drg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
