py:run
py:run python-statement
Runs the given Python statements in the current Python session. To make multi-line Python code easier to run, this command will take multiple strings, each of which will be interpreted as a separate line of Python code. For instance:
(py:run
"import matplotlib"
"matplotlib.use('TkAgg')"
"import numpy as np"
"import matplotlib.pyplot as plt"
"for i in range(10):"
" plt.plot([ x ** i for x in np.arange(-1, 1, 0.1) ])"
"plt.show()"
)py:run will wait for the statements to finish running before continuing. Thus, if you have long running Python code, NetLogo will pause while it runs.