Andrew Williams
Andrew Williams

Reputation: 11

Need help for automatization of a Python function

I have here a python program written for an Enigma 2 Linux Set top box: VirtualZap Python program for Enigma 2 based set top boxes

I want to automatize the execution of the following function every minute:

def aktualisieren(self):  
    self.updateInfos()

You can find the defined function within line 436 and 437.

My problem is that class VirtualZap contains only one constructor but no main method with the actual program run, therefore it is difficult to implement threads or coroutines. Is there any possibility to automatize the execution of the aktualisieren function?

Upvotes: 1

Views: 59

Answers (1)

MichaelMMeskhi
MichaelMMeskhi

Reputation: 689

There is an Advanced Python Scheduler

from apscheduler.schedulers.blocking import BlockingScheduler

def aktualisieren(self):  
    self.updateInfos()

scheduler = BlockingScheduler()
scheduler.add_job(aktualisieren, 'interval', hours=1)
scheduler.start()

Upvotes: 0

Related Questions