I've been struggling with Python <-> PHP interaction when trying to run a Python code inside my Moodle Plugin.
I've created a block following the instructions displayed at https://docs.moodle.org/dev/Blocks, and everything works fine, until I try to run any external code that is not just a "print something".
I've tried many different ways to call a Python code within my get_content() method (described in the link above), such as escapeshellcmd/shell_exec which provided only "print" outputs, without even being capable of inserting line breaks or other ways to display the data other than a continuous single line; also tried using pipes, but got no output from that, don't know if I used it correctly though.
I just want to be able to call a Python code from my PHP Block, and display something like a graph or so as an output. Currently I'm only able to output the data from the DB i'm gathering it as a "print", which is kind of messy.
I'm using Moodle 3.8 and tried some variations of Python (2.7, 3.5, 3.6, 3.8).
Thanks in advance.