mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-09 05:26:48 +00:00
🐛 fix parent detect error after require (#1121)
This commit is contained in:
@ -9,7 +9,7 @@ FrontMatter:
|
||||
|
||||
import warnings
|
||||
|
||||
from . import _current_plugin
|
||||
from . import _current_plugin_chain
|
||||
|
||||
|
||||
class Export(dict):
|
||||
@ -58,7 +58,7 @@ def export() -> Export:
|
||||
"See https://github.com/nonebot/nonebot2/issues/935.",
|
||||
DeprecationWarning,
|
||||
)
|
||||
plugin = _current_plugin.get()
|
||||
if not plugin:
|
||||
plugins = _current_plugin_chain.get()
|
||||
if not plugins:
|
||||
raise RuntimeError("Export outside of the plugin!")
|
||||
return plugin.export
|
||||
return plugins[-1].export
|
||||
|
Reference in New Issue
Block a user