@@ -250,15 +250,17 @@ def exec_module(self, module: ModuleType, config: dict[str, Any] | None = None)
250250 is_sub = True
251251 if config is None or not {k : v for k , v in config .items () if k not in ("$path" , "$static" )}:
252252 config = plugin .config .copy ()
253+ config ["$path" ] = plugin ._config_key
253254 for key in config :
254255 if key .startswith ("." ) and self .plugin_id .endswith (key ):
255256 config = config [key ]
257+ config ["$path" ] = plugin ._config_key # type: ignore
256258 break
257259
258260 if self .loaded :
259261 return
260262
261- if config is None or not {k : v for k , v in config .items () if k not in ("$path" , "$static" )}:
263+ if config is None or ( not is_sub and not {k : v for k , v in config .items () if k not in ("$path" , "$static" )}) :
262264 key = module .__name__
263265 if key .startswith ("arclet.entari.builtins." ) and f"::{ key [23 :]} " in EntariConfig .instance .plugin :
264266 key = f"::{ key [23 :]} "
@@ -378,6 +380,9 @@ def find_spec(
378380 if module_spec .parent and module_spec .parent == plug .module .__name__ :
379381 module_spec .loader = PluginLoader (fullname , module_origin , origin_id_ or fullname , plug .id )
380382 return module_spec
383+ elif module_spec .parent == module_spec .name and module_spec .name .rpartition ("." )[0 ] == plug .module .__name__ :
384+ module_spec .loader = PluginLoader (fullname , module_origin , origin_id_ or fullname , plug .id )
385+ return module_spec
381386 elif module_spec .name in _SUBMODULE_WAITLIST .get (plug .module .__name__ , ()):
382387 module_spec .loader = PluginLoader (fullname , module_origin , origin_id_ or fullname , plug .id )
383388 # plugin_service.referents.setdefault(module_spec.name, set()).add(plug.id)
0 commit comments