doc: 添加热重载相关注释

This commit is contained in:
Rock Chin
2023-01-02 13:06:48 +08:00
parent f5bf012ba7
commit 85471fd0df
4 changed files with 13 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ from main import log_colors_config
def walk(module, prefix=''):
"""遍历并重载所有模块"""
for item in pkgutil.iter_modules(module.__path__):
if item.ispkg:
walk(__import__(module.__name__ + '.' + item.name, fromlist=['']), prefix + item.name + '.')
@@ -29,6 +30,7 @@ def reload_all():
import main
main.stop()
# 重载所有模块
context = pkg.utils.context.context
walk(pkg)
importlib.reload(__import__('config'))