This is a common mistake, the way you have written this python will
call 'someDef(someList)' and pass its results to named argument 'command'.
There are a couple ways to get this to work the way you would like. My
personal choice is this
# Define a function that can take any named or unnamed arguments
# the * tells python to put any unnamed arguments into a list
# the ** tell python to put any names arguments into a dictionary
def someDef( *args, **kwargs ):
# call function or have inline code that creates someList
someList = getSomeList()
print someList
def buildUI():
# <insert all stuff that defines window>
# create button and pass the function it self to the argument
# command=someDef() # will pass the result where as
# command=someDef # passes the actual function to the argument
> cmds.button(command=someDef)
If you really want to pass in data in the call as its being defined
you should use a lambda. A lambda is an unamed function. I have heard of
lambdas being buggy in certain instances because of how they are defined and
stored in memory in modules like pyqt. Here is how you could write is.
def buildUI():
# ' ' ' ' ' ' ' ' ' ' ' \/
> cmds.button(command=lambda *args : someDef(someList ))
If you new the namespace of you function you could always pass it as a
string to 'command'.
def buildUI():
# ' ' ' ' ' ' ' ' ' ' ' \/
> cmds.button(command="myModule.someDef([%s] )" % str(someList))
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---