python schedule package with init function

Question:

I need to create a init function, which needs to run before the scheduler starts. I am using the schedule package.

Is there an easy way to add an init function, which runs before the scheduler starts.

import schedule 
def call_me(): 
  print("I am invoked")
schedule.every(1).seconds.do(call_me)
while True: 
  schedule.run_pending()
Asked By: stylepatrick

||

Answers:

Directly invoke the function before using schedule:

call_me()
schedule.every(1).seconds.do(call_me)
# ...
Answered By: Unmitigated
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.