Scheduled task not working

I wrote the following script(f_cron.py) for sending mail using erpnext.It works fine when I run it using bench execute but when I put it inside the erpnext/hooks.py scheduler_events “all” it does not run.(My python script file is also in the same folder as the hooks.py).

f_cron.py:-
import frappe
def send_mail():
frappe.sendmail(recipients="xyz@gmail.com",sender="pqr@gmail.com",subject=“A test email”)

Bench doctor shows scheduler is online.
Please tell me how to resolve the problem.