re = sra.Program() engine = re.buildRecognizer() #create Speech Recognition Engine #for now, only used to receive start command def onLineRead(): global started message = vm.line.strip() if message == "start": re.runRecognizer(engine) #start listening started = True #changes to exit first while loop vm.setOnReadLine(onLineRead) IPC.InitSync() #keep checking if it should start listening while not started: vm.tryReadLine() IPC.Sync() while re.Listening == True: #while listening index = re.grabCommand() #access recognized command timeout = time.time() if index == 0: Lily = True lilytime = time.time() elif Lily == True: if not index == -1: #-1 means queue is empty if timeout < lilytime + 5: if index == 6: #index 6 is a quit command