0

I'm making a script that runs the script every 10 seconds (for example)

But i get this:

AttributeError: partially initialized module 'schedule' has no attribute 'every' (most likely due to a circular import)

My code:

import schedule
import time

def job():
    print("I'm working...")

schedule.every(3).seconds.do(job)

while True:
    schedule.run_pending()
    time.sleep(1)
John Jain
  • 19
  • 2
  • 7

2 Answers2

0

Thanks to Azat Ibrakov & Abdul Aziz Barkat for saying that i need to rename my python script.

Thanks to joao for saying that its "run_pending" and not "run.pending".

Working code:

import schedule
import time

def job():
    print("I'm working...")

schedule.every(3).seconds.do(job)

while True:
    schedule.run_pending()
    time.sleep(1)
John Jain
  • 19
  • 2
  • 7
-1
import schedule
import time

def job():
    print("I'm working...")

schedule.every(3).seconds.do(job)

while True:
    schedule.run.pending()
    time.sleep(1)
mhhabib
  • 2,975
  • 1
  • 15
  • 29