Skip to content

Commit

Permalink
make plugin setup concise
Browse files Browse the repository at this point in the history
  • Loading branch information
winglian committed Dec 30, 2024
1 parent 5bf4c60 commit 2909e6e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/axolotl/integrations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,17 @@ def load_plugin(plugin_name: str) -> BasePlugin:
module_name, class_name = plugin_name.rsplit(".", 1)

# import the module
module = importlib.import_module(module_name)
try:
module = importlib.import_module(module_name)
except ModuleNotFoundError as orig_exc:
try:
if not module_name.startswith("axolotl.integrations."):
module = importlib.import_module("axolotl.integrations." + module_name)
else:
raise orig_exc
except ModuleNotFoundError as exc:
raise orig_exc from exc

# instantiate the class
plugin_class = getattr(module, class_name)
# create an instance of the class
Expand Down

0 comments on commit 2909e6e

Please sign in to comment.