prompt_toolkit Table of Contents Support command history(up-arrow reveals prev commands) Support command history(up-arrow reveals prev commands) howto Use prompt_toolkit.PromptSession from prompt_toolkit import PromptSession session = PromptSession() while True: session.prompt() To persist a history to disk from prompt_toolkit import PromptSession from prompt_toolkit.history import FileHistory session = PromptSession(history=FileHistory('~/.myhistory')) while True: session.prompt() https://python-prompt-toolkit.readthedocs.io/en/stable/pages/asking_for_input.html#history