def DoSomething(var): print var ... variable = "hello world!" cmds.button(label="My Button", command=DoSomething(variable))
I have the following pseudo code. All I want to do is have the function DoSomething print whatever is passed to it. But whatever I try, I get the following error:
# Error: TypeError: Invalid arguments for flag 'command'. Expected string or function, got NoneType #
How can you pass an argument from the button to a function?