How to call non whitelisted or class function using frappe call

Hello all,

I have one function fn_calculate_cost(self) in python file which is not a whitelist function.
so i want to call that function using frappe.call(). how to call that function.

Thanks and regards

If your function are in same doctype python file use this frappe call

frappe.call({
      method: "fn_calculate_cost",
      doc: frm.doc,
      callback: function(r) {
	     console.log(r.message)
      }
  });

Thank You Sir