refactor: 修改引入风格

This commit is contained in:
RockChinQ
2023-11-13 21:59:23 +08:00
parent e3b280758c
commit 665de5dc43
47 changed files with 324 additions and 364 deletions

View File

@@ -1,10 +1,9 @@
import logging
import threading
import importlib
import pkgutil
import pkg.utils.context as context
import pkg.plugin.host
from . import context
from ..plugin import host as plugin_host
def walk(module, prefix='', path_prefix=''):
@@ -15,7 +14,7 @@ def walk(module, prefix='', path_prefix=''):
walk(__import__(module.__name__ + '.' + item.name, fromlist=['']), prefix + item.name + '.', path_prefix + item.name + '/')
else:
logging.info('reload module: {}, path: {}'.format(prefix + item.name, path_prefix + item.name + '.py'))
pkg.plugin.host.__current_module_path__ = "plugins/" + path_prefix + item.name + '.py'
plugin_host.__current_module_path__ = "plugins/" + path_prefix + item.name + '.py'
importlib.reload(__import__(module.__name__ + '.' + item.name, fromlist=['']))