#https://stackoverflow.com/questions/2408560/non-blocking-console-input ''' what i thought: - input() in another thread - that were filling a global strings list - strings are being popped in the main thread ''' import threading consoleBuffer = [] def consoleInput(myBuffer): while True: myBuffer.append(input()) threading.Thread(target=consoleInput, args=(consoleBuffer,), daemon=True).start() # start the thread import time # just to demonstrate non blocking parallel processing while True: time.sleep(2) # avoid 100% cpu print(time.time()) # just to demonstrate non blocking parallel processing if consoleBuffer: msg = repr(consoleBuffer.pop(0)) print("msg = ",msg)