A simple program (with messy output) to start a counter (robot moving) while getting info from the keyboard. See Doug Hellmann's Python Module of the Week, "Managing Shared State" at https://pymotw.com/3/multiprocessing/communication.html You create a Manager Dictionary, pass it to the process per the example at PyMOTW, and then use it like a regular dictionary from within or outside of the process.
import time from multiprocessing import Process def another_process(spaces): ctr=1 print("spaces", len(spaces)) while True: print(spaces, ctr) ctr += 1 time.sleep(1) if __name__ == "__main__": spaces="" ## start with one running process processes_list=[] p=Process(target=another_process, args=(spaces,)) p.start() processes_list.append(p) while True: option=input('''"s" to start another process "q" to quit this program ''') option=option.lower() if "s" == option: spaces += " " p=Process(target=another_process, args=(spaces,)) p.start() processes_list.append(p) elif "q" == option: for p in processes_list: p.terminate() p.join() break