Circular import error

While monkey patching SalarySlip class got a circular import error.

File “/opt/bench/erpnext/apps/frappe/frappe/translate.py”, line 193, in get_full_dict
frappe.local.lang_full_dict = load_lang(lang)
File “/opt/bench/erpnext/apps/frappe/frappe/translate.py”, line 216, in load_lang
path = os.path.join(frappe.get_pymodule_path(app), “translations”, lang + “.csv”)
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 875, in get_pymodule_path
return os.path.join(os.path.dirname(get_module(scrub(modulename)).file), *joins)
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 837, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “/opt/bench/erpnext/apps/customize_attached_print_format/customize_attached_print_format/init.py”, line 6, in
import erpnext.hr.doctype.salary_slip.salary_slip as custom_salary_slip
File “/opt/bench/erpnext/apps/erpnext/erpnext/hr/doctype/salary_slip/salary_slip.py”, line 17, in
from erpnext.hr.doctype.payroll_period.payroll_period import get_period_factor, get_payroll_period
File “/opt/bench/erpnext/apps/erpnext/erpnext/hr/doctype/payroll_period/payroll_period.py”, line 10, in
from erpnext.hr.utils import get_holidays_for_employee
File “/opt/bench/erpnext/apps/erpnext/erpnext/hr/utils.py”, line 422, in
@erpnext.allow_regional
AttributeError: partially initialized module ‘erpnext’ has no attribute ‘allow_regional’ (most likely due to a circular import)

1 Like

Hello @kunhi_mohamed Please were you able to resolve this?