Jython
A module that allows you to execute Python code in BoxLang
This module allows you to execute python in BoxLang via Jython. This is a very powerful feature that allows you to execute python code in your BoxLang scripts. It also allows you to create python modules and classes that can be used in your BoxLang scripts by using the jythonEvalFile( path )
function.
Usage
You can execute python code in your BoxLang scripts by using the jythonEval( code )
function. Here is an example:
You can also evaluate python code from a file by using the jythonEvalFile( path )
function. Here is an example:
You can also create python modules and classes that can be used in your BoxLang scripts. Here is an example:
You can also use the <bx:jython>{python code}</bx:jython>
tag to execute python code in your BoxLang scripts. Here is an example:
Bindings
We will automatically bind all the variables in your variables
scope into the engine bindings via JSR223. You can then use them as native variables in your python code.
Result
Each execution produces a result which is a structure with the following keys:
engine
: A reference to the engineglobalScope
: A reference to the global scope of JSR223engineScope
: A reference to the engine scope of JSR223
Last updated
Was this helpful?