Setting doc events in Server Side Script

I wrote a custom script for on load for employee doctype lets say:
employee.py:
def onload(self):
frappe.msgprint(“onload called”)

hooks.py:
doc_events = {
“Employee”:{
“onload”:“erpnext.setup.doctype.employee.employee.Employee.onload”
},

getting an error:
ModuleNotFoundError: No module named ‘erpnext.setup.doctype.employee.employee.Employee’; ‘erpnext.setup.doctype.employee.employee’ is not a package

How to resolve this?

The DT Employee seems to be in another module.

You can open the doctype list, locate Employee, and see the module it is part of.

Then adapt your “onload” triggered path accordingly.

The Employee DT controller lives in:

/apps/frappe/erpnext/setup/doctype/employee/employee.py

See its code here:

Here are examples of how the path is built (click to see more of them than shown here):

the path was correct, actually I did not need to specify the onload in hooks.py, it worked fine without it. the problem is when i send data to frontend I wana remove certain fields being sent and displayed on form. but its not wokring, any suggestion it?

		doc_dict= self.as_dict()
		for field in sensitive_fields:
			if field in doc_dict:
				// dont send this field to frontend