Hi,
I am writing a Plugin in C++ and I am having trouble figuring out how to get a return from python execute code.
For instance, this works perfectly:
MString pyCommand2;
pyCommand2 = "cmds.joint()";
auto test2 = MGlobal::executePythonCommandStringResult(pyCommand2);
MGlobal::displayInfo(test2);
Here I get displayed "joint1", so it is catching the return. But this doesn't work
MString pyCommand;
pyCommand =
"def foo():\n"
" xx = cmds.joint()\n"
" return xx\n"
"
foo()";
auto test1 = MGlobal::executePythonCommandStringResult(pyCommand);
MGlobal::displayInfo(test1);
Here the return value that
MGlobal::displayInfo(test1) should provide is empty.
Any ideas?
thanks