expect is for a different purpose. It runs commands on a captive program. You, by contrast, are asking for a way to send commands to a process already running in the background.
As a bare-bones minimal example of what you want, let's create a FIFO:
$ mkfifo in
A FIFO is a special file that one process can write to while a different process reads from it. Let's create a process to read from our FIFO file
$ python <in &
Now, let's send
python a command to run from the current shell:
$ echo "print 1+2" >in
The output from
3 and appears here on stdout. If we had redirected python's stdout, it could be sent elsewhere.
expect allows you to automate interaction with a captive command. As an example of what
expect can do, create a file:
send "print 1+2\r"
Then, run this file with
$ expect myfile
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print 1+2