title: Python - Passing arguments to an already running process
body: <p>first of all, i´m pretty new to Python. I also searched for a solution, but i guess the usual approach (subprocess.popen) won´t work in my case.</p>
  
  <p>I have to pass arguments to a listener in an already running python script without starting the script over and over again. There is an example how to pass a message to a lcd-screen:</p>
  
  <pre><code>function printMsgText(message_text)
  local f = io.popen("home/test/show_message.py '" .. message_text .. "'")
  end
  </code></pre>
  
  <p>This lua-script above defines the process which gets called everytime a message is recieved. The called process (show_message.py) looks like that:</p>
  
  <pre><code>import sys
  from sense_hat import SenseHat
  sense = SenseHat()
  sense.clear()
  sense.show_message(sys.argv[1])
  </code></pre>
  
  <p>I need something similar, except that there is another script running in the backround, so show_message.py is not the final process but needs to pass the argument/message to another, already running script. My idea was to just let show_message.py print the message to the console and use sys.argv in the main process aswell but i´m a little afraid that it could get messy.</p>
  
  <p>Is there any easy way to do this?
  Kind regards</p>
  
  <p>Edit: </p>
  
  <p>The main script is controlling a stepper-motor. Based on the user input, the motor drives a pre-defined number of steps. The part of the script waiting for the user-input looks like this:</p>
  
  <pre><code>while wait:
              user_position = input("Where do you wanna go? (0, 1, 2, back): ")
              wait = False
              #  Console output
              print("Position: " + str(user_position))
  
              if user_position == "0":
                  stepper.set_target_position(position_zero)
                  wait = True
              elif user_position == "1":
                  stepper.set_target_position(position_one
                  wait = True
              elif user_position == "2":
                  stepper.set_target_position(position_two)
                  wait = True
              elif user_position == "back":
                  break
  </code></pre>
  
  <p>Now i need to pass the desired position via a web-application which is designed the way i described above (e.g. calling a lua-script every time a variable/argument is passed) and not via the console. </p>