Return Output from Python Scripting Modules in Bonsai #2005
-
Hello! I just started using the Python Scripting package and am hoping to use outputs from the scripts I'm importing to use in Bonsai. Would this be possible/feasible? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, Yes, you can share variables between python and Bonsai. When you use |
Beta Was this translation helpful? Give feedback.
Hi,
Yes, you can share variables between python and Bonsai. When you use
Get
to access a variable inside of python, you can treat the output like a string and transform the output into other data types. For example, if your python variable is convertible to a double, you can use anExpressionTransform
and callConvert.ToDouble(it)
, which will output a double. I've attached a simple workflow to demonstrate this: python-conversion.zip. For more complex data types, you may want to use a tool like Bonsai.Sgen, or you can check out how we transform python data types in the Bonsai.ML package.