Frappe Whitelist Method Not Working

Hello Every One,

I have call one python function from my js file using method, but when I run my code it give me following error,

Traceback (innermost last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 51, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 69, in handle
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 80, in execute_cmd
method = get_attr(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 101, in get_attr
method = frappe.get_attr(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 737, in get_attr
return getattr(get_module(modulename), methodname)
AttributeError: ‘module’ object has no attribute ‘test’

Below Are My Code For JS & PY Files

JS File:{
type: “GET”,
method: “”,
callback: function(r) {

PY File :

def test():
frappe.msgprint(“In PY Function”)
return True

Thanks in advance.

Your code looks fine, can you ensure that the function is definitely in that module?

Try running the test() function directly by doing :

bench execute

You might have to give a --site option