I've written a simple Python program to simulate the behavior of the program you describe. At a bare minimum, this puts us all in the position of talking about the same thing instead of assuming how your program works. (Of course, if your program doesn't actually work the way I'm describing it here, please correct me.)
#!/usr/bin/python
def read_a_file():
print('Type the contents of a file now.')
while True:
try:
s = raw_input('>')
except EOFError:
break
read_a_file()
read_a_file()
print('We have now read two files. Quitting.')
You can run this script, type the contents of the first file, hit CTRL-D, type the contents of the second file, hit CTRL-D, and the program exits. This appears to be the behavior you're describing.
My first thought was to use expect, as chaos suggested. However, I can't find any support in expect for piping the contents of a file to a process. (I assume the contents of the files are different every time. If they're the same, then expect would work, just by putting the contents of the files in the expect script.)
I should note that I'm by no means an expect expert; there may be a way to do this that isn't obvious to me.
My second thought was to write a Python script that launched your program, and fed it the contents of the files and the EOF characters. However, Jonathan Leffler's comments made me think that echoing EOF characters would not work.
My third thought is pretty damn kludgy. You could write a script that creates an expect script by plugging the contents of the files into the expect script, and then executing the expect script. I suspect that would work.