mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-08 14:56:03 +00:00
feat: 重载后恢复诸个单例对象
This commit is contained in:
@@ -3,6 +3,7 @@ import logging
|
||||
import pkg
|
||||
import importlib
|
||||
import pkgutil
|
||||
import pkg.utils.context
|
||||
|
||||
|
||||
def walk(module, prefix=''):
|
||||
@@ -15,5 +16,7 @@ def walk(module, prefix=''):
|
||||
|
||||
|
||||
def reload_all():
|
||||
context = pkg.utils.context.context
|
||||
walk(pkg)
|
||||
importlib.reload(__import__('config'))
|
||||
pkg.utils.context.context = context
|
||||
|
||||
Reference in New Issue
Block a user