Scheduler and pool.apply_async in frappe

Hi ,
We have a function ‘A’ calling pool.apply_async(f, args = (count, )).
It is working fine if we call directly as an API, but if we call function A from scheduler ‘pool.apply_async’ is not working.Need help to solve this.

Can you share the full code

Thank you for reply.

‘asymethod’ called from Scheduler …

@frappe.whitelist(allow_guest=True)
def asymethod():
    pool = Pool(processes=1)
    count=101
    result = pool.apply_async(testFun, args = (count, ))
    pool.close()
    pool.join()


@frappe.whitelist(allow_guest=True)
def testFun():
  
    my_sql="update `tabSomeTable` set complete='121'"
    frappe.db.sql(my_sql)

I am not sure what are you trying to do here. If you want to push something to the background try frappe.enqueue