A simpler example is PyCLIModule4Test example:
- Module parameters/GUI specification: https://github.com/Slicer/Slicer/blob/master/Base/QTCLI/Testing/PyCLIModule4Test.xml
- Executed python script:
https://github.com/Slicer/Slicer/blob/master/Base/QTCLI/Testing/PyCLIModule4Test.py
In the executed Python script you can launch an external Python interpreter (Python3, anaconda, etc.), similarly to how it is done here: Subprocess call in Python interpreter results in memory corruption