If your program just needs a fixed input read from stdin then you can do it with the subprocess module, as grim says.

If the program needs to interact with your program, for example it prints something and then your program types in a response, then you to use pexpect. This only works on unix systems or cygwin though.