Question: How can I access the output of a cmaple script within memory?

Currently I am using maple as a backend computer algebra system that is doing the heavy lifting for an application written in python. 

The procedure I currently use is:

app.py
```
from subprocess import run
my_input = 1233
cmd = 'cmaple -q -c input:={}: backend.mpl'.format(my_input) # Command Line call to cmaple
output = run(cmd, capture_output=True)
stdout = str(output.stdout) # A bytes object i.e. b'            1234\n\r\n\r'
# Do some string operations on stdout to get the output I want
output = stdout[-12:-8] # '1234'
```

backend.mpl
```
#do something with my_input
output := my_input+1:
#print to console to be recovered later
print(output);
quit:
```
This setup works reasonable well so long as I know exactly what format the ```output``` is going to be in but is not effective when I want to access more than one ```output``` or when the required ```output``` is a float.

I realise that I could likely save these variables to a file (a .csv say) and load them into ```app.py``` that way, but the dream is that there would be some way to directly access the variables in ```backend.mpl``` from within memory, an analogue of the ```Pipe``` framework in python for example?
 

Please Wait...