title: Python script to monitor values from another running script
body: <p>I am starting a basic python job. My main script runs code that controls something. I then want a second python script to monitor these values and print them in the console. The main script is in a constant while loop so I have to have this code separate but I can't get it working.</p>
  
  <p>Example Scenario:</p>
  
  <p>Main script has a value of 'x' that is moving a wheel. I only access the value 'x' when it's equal to 20 so outputting values whenever x is accessed wouldn't work.
  The monitor programs needs to be able to capture and output the change in between.</p>
  
  <p>file1.py</p>
  
  <pre><code>x = 0
  
  while True:
      x = x + 1
      if x == 20:
          print('X = 20 ... Resetting X = 0')
          x = 0
  </code></pre>
  
  <p>file2.py --</p>
  
  <pre><code>import file1
  import time
  
  while True:
      print(x)
      time.sleep(0.1)
  </code></pre>
  
  <p>Note -- The code above is not my exact scenario and I can't use it here because it wouldn't work since it's using a module to access an external device. But this is roughly what I am trying to do.</p>
  
  <p>Thanks</p>