'is posible event handle even main code still running?

Is possible to use event handle during main code is running?

current my main code is schedule every hour to run a funtion and I hope to run event handle in same time.

def sendMessage():
//code
if (__name__ == "__main__"):
schedule.every(60).minutes.do(sendMessage)

where should i put below code to handler the event?
I try to put inside if and also outside if statement but event handle still not running.

@client.on(events.NewMessage())
  def handler(event):
    //event


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source