pyrun
Run Python statements from Nelson.
📝 Syntax
pyrun(code)
outvars = pyrun(code, outputs)
outvars = pyrun(code, outputs, pyName, pyValue)
📥 Input argument
code - a string scalar, string array, character vector, character array or python code object.
pyName, pyValue - Input arguments name and value
outputs - string array: Python variable names.
📤 Output argument
outvars - One or more Nelson workspace variable names returned as valid Python types.
📄 Description
pyrun(code) function executes Python statements present in the code string within the Python interpreter.
Variables generated by thepyrun function remain persistent, allowing their usage in subsequentpyrun calls.
outvars = pyrun(code, outputs) Python variables specified in outputs are returned to Nelson.
The values of these variables are captured inoutvars.
outvars = pyrun(code, outputs, pyName, pyValue), thecode is executed with assigned input and output variable names using Nelson data passed through one or more name-value arguments.
💡 Examples
Python code object representing a script generated through the built-in compile function in Python
🔗 See also
pyrunfile, pyenv, Python types supported.
🕔 History
1.3.0
initial version
1.4.0
Python code object allowed as first input argument
Last updated
Was this helpful?