fix: Check if path is a module first then function

This commit is contained in:
Faris Ansari 2021-04-22 06:03:35 +05:30
parent b32db6e329
commit 976ebd5b2c

View file

@ -149,7 +149,11 @@ def get_jinja_hooks():
def get_obj_dict_from_paths(object_paths):
out = {}
for obj_path in object_paths:
obj = frappe.get_attr(obj_path)
try:
obj = frappe.get_module(obj_path)
except ModuleNotFoundError:
obj = frappe.get_attr(obj_path)
if isinstance(obj, ModuleType):
functions = getmembers(obj, isfunction)
for function_name, function in functions: