title: How do I schedule a function to run everyday at a specific time in discord.py?
body: <p>I want the bot to run a defined function everyday. I did some research and then I was able to write this:</p>
  <pre class="lang-py prettyprint-override"><code>def job():
      print(&quot;task&quot;)
      
  schedule.every().day.at(&quot;11:58&quot;).do(job)
  
  while True:
      schedule.run_pending()
      time.sleep(1)
  </code></pre>
  <p>but this code is blocking all other functions so I did some more research from other stack overflow answers and then I was able to write this:</p>
  <pre class="lang-py prettyprint-override"><code>def job():
      print('hi task')
  
  def threaded(func):
      job_thread = threading.Thread(target=func)
      job_thread.start()
  
  if __name__==&quot;__main__&quot;:
  
      schedule.every().day.at(&quot;12:06&quot;).do(threaded,job)      
      while True:
          schedule.run_pending()
  </code></pre>
  <p>unfortunately this too , blocks my entire code. I need something that doesn't block other parts of my code. How to do that?</p>