If I understand what you want, you can achieve this by simply importing the readline module. This will change the behavior of raw_input() , so that it will be more like an interactive python shell in terms of history and line editing.
Be careful, but it is possible to build python without readline , so I would suggest importing it inside a try block:
try: import readline except: pass
source share