diff --git a/InvenTree/plugin/apps.py b/InvenTree/plugin/apps.py index 66c2428664..33b70cb9fc 100644 --- a/InvenTree/plugin/apps.py +++ b/InvenTree/plugin/apps.py @@ -24,8 +24,6 @@ except: from maintenance_mode.core import maintenance_mode_on from maintenance_mode.core import get_maintenance_mode, set_maintenance_mode -from InvenTree.helpers import log_plugin_error - from plugin import plugins as inventree_plugins from plugin.integration import IntegrationPluginBase @@ -53,6 +51,8 @@ class PluginAppConfig(AppConfig): # region public plugin functions def load_plugins(self): """load and activate all IntegrationPlugins""" + from InvenTree.helpers import log_plugin_error + logger.info('Start loading plugins') # set maintanace mode _maintenance = bool(get_maintenance_mode()) @@ -143,6 +143,7 @@ class PluginAppConfig(AppConfig): :type disabled: str, optional :raises error: PluginLoadingError """ + from InvenTree.helpers import log_plugin_error from plugin.models import PluginConfig logger.info('Starting plugin initialisation') diff --git a/InvenTree/plugin/plugins.py b/InvenTree/plugin/plugins.py index d215faacdd..a8b08cf6b4 100644 --- a/InvenTree/plugin/plugins.py +++ b/InvenTree/plugin/plugins.py @@ -9,8 +9,6 @@ import logging from django.conf import settings from django.core.exceptions import AppRegistryNotReady -from InvenTree.helpers import log_plugin_error - # Action plugins import plugin.builtin.action as action from plugin.action import ActionPlugin @@ -29,6 +27,8 @@ def iter_namespace(pkg): def get_modules(pkg, recursive: bool = False): """get all modules in a package""" + from InvenTree.helpers import log_plugin_error + if not recursive: return [importlib.import_module(name) for finder, name, ispkg in iter_namespace(pkg)]