AttributeError: 'module' object has no attribute 'get_cust_detail'

Hi,

I am using a function to fetch some data from the database. I call the function in my .js file from the python file.

python function:

@frappe.whitelist()
    def get_cust_detail(self, s_id):
       if(frappe.db.sql("select `customer_name` from `tabcustomer` where shs_id=%s", (s_id,))):
          frappe.errprint(s_id)
          return{            
          "province":str(frappe.db.sql("select `province` from `tabcustomer` where shs_id=%s", (s_id,)))[4:str(frappe.db.sql("select `province` from `tabcustomer`` where shs_id=%s", (s_id,))).index(",)")-1],
          "district":str(frappe.db.sql("select `district` from `tabcustomer` where shs_id=%s", (s_id,)))[4:str(frappe.db.sql("select `district` from `tabcustomer`` where shs_id=%s", (s_id,))).index(",)")-1],
          "commune":str(frappe.db.sql("select `commune` from `tabcustomer` where shs_id=%s", (s_id,)))[4:str(frappe.db.sql("select `commune` from `tabcustomer` where shs_id=%s", (s_id,))).index(",)")-1],
          "village":str(frappe.db.sql("select `village` from `tabcustomer` where shs_id=%s", (s_id,)))[4:str(frappe.db.sql("select `village` from `tabcustomer` where shs_id=%s", (s_id,))).index(",)")-1],
           "customer_name":str(frappe.db.sql("select `customer_name` from `tabcustomer` where shs_id=%s", (s_id,)))[4:str(frappe.db.sql("select `customer_name` from `tabcustomer` where shs_id=%s",      (s_id,))).index(",)")-1],
           "phone":str(frappe.db.sql("select `phone` from `tabcustomer` where shs_id=%s", (s_id,)))[4:str(frappe.db.sql("select `phone` from `tabcustomer` where shs_id=%s", (s_id,))).index(",)")-1],
            "product_type":str(frappe.db.sql("select `product_type` from `tabcustomer` where shs_id=%s", (s_id,)))[4:str(frappe.db.sql("select `product_type` from `tabcustomer` where shs_id=%s", (s_id,))).index(",)")-1]        
       }

javascript code calling the function:

cur_frm.cscript.shs_id = function(doc) {
cur_frm.call({
method: “get_cust_detail”,
args: { s_id : doc.shs_id},
callback : function(c_detail){
console.log(c_detail);
console.log(c_detail.message.costumer_name);
cur_frm.set_value(“province”, c_detail.message.province);
cur_frm.set_value(“district”, c_detail.message.district);
cur_frm.set_value(“commune”, c_detail.message.commune);
cur_frm.set_value(“village”, c_detail.message.village);
cur_frm.set_value(“costumer_name”, c_detail.message.costumer_name);
cur_frm.set_value(“phone”, c_detail.message.phone);
cur_frm.set_value(“product_type”, c_detail.message.product_type);
}
});
}

However I keep getting the error in the title : AttributeError: ‘module’ object has no attribute ‘get_cust_detail’

Any help is appreciated, thanks

This question can be closed, I’ve figured out the error. Was syntax related