When I try to do it or it just waits for commands or is only sending hourly statuses, I'm not getting it to do both at same time
run.py
class MyClass(object):
def __init__(self):
builder = StackBuilder()
self.stack = builder\
.pushDefault(encryption)\
.push(Layer)\
.build()
self.stack.setCredentials(credentials)
self.stack.setProp(CONTACTS, list(config.keys()))
self.stack.setProp(IDENTITY_AUTOTRUST, True)
def start(self):
print("[Start]\n")
self.stack.Event(LayerEvent(Network.EVENT_STATE_CONNECT))
try:
self.stack.loop(timeout=0.5, discrete=0.5)
except AuthError as e:
print("ERROR: %s" % e)
except KeyboardInterrupt:
print("\nLeaving")
sys.exit(0)
def run_infinite():
while True:
try:
c = MyClass()
c.start()
except:
pass
else:
break
if __name__ == "__main__":
c = MyClass()
c.start()
run.py call my_funcionts.py
my_funcionts.py
def handle(command):
user = [ "rvalentim",
"tgusmao",
]
if command.users in user:
if command.text == "info":
info(command)
elif command.text == "test":
test(message)
else :
other(message)
'''
My funcionts module code
==========================================================
'''
def info(command):
print("Info")
def test(command):
print("Testing")
def other(command):
print("Other info")
'''
==========================================================
'''
my_funcionts.py is in stand by waiting for user to send a command, but when I try to implement multiprocessing, where it continues waiting for commands to be received and at same time leave another routine running where it sends hourly status for example