🐛 fix require new plugin context error (#2040)

This commit is contained in:
Ju4tCode
2023-05-22 00:00:50 +08:00
committed by GitHub
parent 99197f30f6
commit 2cfc20c143
2 changed files with 11 additions and 2 deletions

View File

@ -228,6 +228,7 @@ class PluginLoader(SourceFileLoader):
# detect parent plugin before entering current plugin context
parent_plugins = _current_plugin_chain.get()
for pre_plugin in reversed(parent_plugins):
# ensure parent plugin is declared before current plugin
if _managers.index(pre_plugin.manager) < _managers.index(self.manager):
plugin.parent_plugin = pre_plugin
pre_plugin.sub_plugins.add(plugin)