title: How to make a function run along with my views
body: <p>I have this function, I want it to be working with my view, how could I do it ?</p>
  
  <pre><code>def PlaySound(self):
      while(True):
          if GPIO.input(Snare) == False:
          os.system("path/to/the/sound")
      return ("Is activated")
  </code></pre>
  
  <hr>
  
  <pre><code>def view(request):
      return render(request, "page.html")
  </code></pre>