Scheduled task not working

I wrote the following script( for sending mail using erpnext.It works fine when I run it using bench execute but when I put it inside the erpnext/ scheduler_events “all” it does not run.(My python script file is also in the same folder as the
import frappe
def send_mail():
frappe.sendmail(recipients="",sender="",subject=“A test email”)

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