from app.daemon import daemon def register(app, scheduler): if app.config['NOPAQUE_IS_PRIMARY_INSTANCE']: @scheduler.task('interval', id='daemon', seconds=3) def daemon_task(): with app.app_context(): daemon()