title: having a function run on stand-by
body: <p>I am trying to find a way to have a function run in the background. If the button is pressed the function is triggered. </p>
  
  <pre><code>GPIO.input(22) == False
  print("(----------------------------------------)")
  print("--SYSTEEM UITGESCHAKELD \n--FIJNE DAG VERDER!")
  print("(----------------------------------------)")
  GPIO.output(22,0)
  time.sleep(.23)
  GPIO.output(22,1)
  time.sleep(.23)
  time.sleep(2)
  GPIO.cleanup()
  sys.exit(1)
  </code></pre>
  
  <p>I try it with an <code>if</code> and <code>else</code>. But that will loop forever. Is there something that makes the <code>def</code> run on the background and only triggers when the button is pressed.</p>