I have a main file fileA.py
that controls the lighting in my radio studio based upon GPIO triggers. The part I'm concerned about is in a While True loop as below:
While True:
#other triggers for other things unrelated
if GPIO.input(25) == GPIO.LOW and (state) = 'off':
blue()
studiostatus = "online"
#other triggers for other things unrelated
elif count > 7200:
dbo()
clockoff()
studiostatus = "offline"
I then have a second python file fileB.py
running at the same time on the same Raspberry Pi
import SocketServer
from BaseHTTPServer import BaseHTTPRequestHandler
def some_function():
print "some_function got called"
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/doorbell':
some_function()
self.send_response(200)
httpd = SocketServer.TCPServer(("", 8080), MyHandler)
httpd.serve_forever()
However I would like this to continually update with the studiostatus
varible from fileA.py
so that the line in fileB.py
becomes
if self.path == '/doorbell' and studiostatus = "online":
action1()
elif self.path == '/doorbell' and studiostatus = "offline":
action2()
Any help much appreciated as currently I can't see the wood for the trees in how best to tackle this