I have an issue with a workspaceControl causing Maya to crash due to faulty data on the uiScript -flag.
Docs say that the data has to be a script. Problem is that I cannot hardcode the function call as there are conditionals prior to the control that will decide what function should be called by the workspaceControl.
I tried using functools.partial() but it still crashes. Pseudo-code:
import pymel.core as pm
from functools import partial
def someFunc(someVar, *args):
# UI-building code
if something == "A":
myScriptVar = partial(someFunc, varA)
else:
myScriptVar = partial(someFunc, varB)
pm.workspaceControl(
uiScript=myScriptVar
)
Why does this fail?
(also tried assigning a lambda function to myScriptVar and it gives me the same kind of crash)