Thanks Toni, I actually tried that at one point and get the same error,
except that the error happens when the menu tries to initialize. But I'm
confident my command is working correctly. Perhaps it has to do with the
order in which things get loaded? Maybe my menu plugin is being loaded
before Maya loads the command plugin?

-Tim


On Tue, Apr 22, 2014 at 9:12 AM, Tony Barbieri <[email protected]> wrote:

> Hey Tim,
>
> Rather than passing a string to to the command argument, pass a reference
> to the method itself:
>
> *mds.menuItem(p=shotsMenu, l='Shot Setup', c=ShotSetup)*
>
> This is a big difference between Maya's menu system and Softimages.  It
> also removes the requirement for the methods/functions to be available in
> the global scope which tripped me up when I began working with Softimage's
> menu system.
>
>
>
> On Tue, Apr 22, 2014 at 9:48 AM, Tim Crowson <[email protected]> wrote:
>
>> Sorry to keep pestering...
>>
>> I've got a custom command that I'm wanting to fire via a menuItem in a
>> custom menu. The command runs fine when called via maya.cmds. But so far my
>> menuItem insists on throwing a 'not defined' error for the command flag. Am
>> I following the correct syntax for command flags in Python here?
>>
>> My command is *ShotSetup()*.
>>
>> My menuItem code is:
>> *mds.menuItem(p=shotsMenu, l='Shot Setup', c="ShotSetup()")*
>>
>>  The menu initializes correctly, but when I run that menu item, I get
>> the following error:
>>
>> *# Error: name 'ShotSetup' is not defined*
>> *# Traceback (most recent call last):*
>> *#   File "<maya console>", line 1, in <module>*
>> *# NameError: name 'ShotSetup' is not defined # *
>>
>>
>> -Tim
>>
>> --
>> 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/CAPh%3D1bmnYOThTfWPvz2ZC80AFHZAy9BZSCB9pbBXM9jEUYVxOQ%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAPh%3D1bmnYOThTfWPvz2ZC80AFHZAy9BZSCB9pbBXM9jEUYVxOQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> -tony
>
> --
> 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/CAJhmvsTDrX6iCXaC5bG2DT%2ByfoanHHJ9Nc2jeW9g5de_59xDSw%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAJhmvsTDrX6iCXaC5bG2DT%2ByfoanHHJ9Nc2jeW9g5de_59xDSw%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/CAPh%3D1bmnSS9FssjeL%2BpUubOyT0SEeHviviGxhfYXKMmXSmfPiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to