Hooks not working?

I went to erpnext/erpnext/hooks and added an event to the daily activity: “erpnext.letien_code.update_overdue_projects”, in the scheduler_events section. I ran the test with the command “bench --site vnc execute erpnext.letien_code.update_overdue_projects” which was successful, however when I waited until the next day I noticed the daily activity was not running. So what’s the problem? Is it related to the running mode? am I running in development mode?

First, test the code in the bench console to see if it’s working. If the code is working, check whether the scheduler is active. You can verify the scheduler status in the rq job. If it’s inactive, activate it using the scheduler command. Also, check if the scheduler_events path is correct. In development mode, the scheduler works if the bench is running, but if the site is running on a serve port, scheduler_events won’t work.

-test run. I tested it this way and it worked perfectly. This is also the path that I write in hooks

~/frappe-bench$ bench --site vnc console
Apps in this namespace:
frappe, erpnext, hrms

In [1]: from erpnext.letien_code import update_overdue_projects

In [2]: update_overdue_projects()

-Test run. I tried the method below

~/frappe-bench$ bench doctor
-----Checking scheduler status-----
Workers online: 2
-----None Jobs-----

I only have 1 site and ran the command “Bench start”

Then apply

frappe.db.commit()

and check effect, it is done or not?

As stated in the problem I tested this way on the console and the function runs perfectly fine, exactly as expected.

In [1]: from erpnext.letien_code import update_overdue_projects

In [2]: update_overdue_projects()

You can check the concept here.

Also, check the reference video: