In addition to Eduard's answer, a short example based on sending Python's exec command to Python (assuming Python 3.*) to execute a Python script stored in a file:

(1)  Create a testfile.py in some folder that Python has access to, add the following lines to testfile.py:

f=open('disk:/path/to/your/folder/output.txt','w')
print('Hello Python Gateway',file=f)
f.close()

Save and close testfile.py

(2)  Open  IRIS Terminal, type and execute one by one the following commands:

set sc=##class(isc.py.Callout).Setup()

set sc=##class(isc.py.Main).SimpleString("exec(open('disk:/path/to/your/folder/testfile.py').read())",,,.sc)

(3) Check the output.txt file that has been created in your folder

Hi Alex, for an unlimited tooling consider trying ML Toolkit (Python Gateway and R Gateway). These extensions enable usage of Python and R in-IRIS (terminal, COS classes, Ensemble BPLs). The results obtained via Python and R (can be combined in one class/BPL) are written to a Caché table and can be visualized using DeepSee (as a Dashboard or as a graphical image formed in Python/R). Like this one, for example:

The BPL that generates the above example (please, note that the particular step is implemented in R while the surrounding steps are in Python):