From 976ebd5b2c2d4188db1bfe38b29f9badd709eb5b Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 22 Apr 2021 06:03:35 +0530 Subject: [PATCH] fix: Check if path is a module first then function --- frappe/utils/jinja.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frappe/utils/jinja.py b/frappe/utils/jinja.py index 42ab267381..a77eca4977 100644 --- a/frappe/utils/jinja.py +++ b/frappe/utils/jinja.py @@ -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: