Skip to content

Commit

Permalink
Add plugin path to sys.path to allow dynamic loading of modules (#872)
Browse files Browse the repository at this point in the history
  • Loading branch information
luzip665 committed May 5, 2023
1 parent 8022fe5 commit a5f25d0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/cd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ class CdPlugin:

def __import_dependency(self, module_name):
try:
full_name = 'plugins.cd.' + module_name + '_parser'
return importlib.import_module(full_name)
sys.path.append(os.path.dirname(__file__))
full_name = module_name + '_parser'
imported = importlib.import_module(full_name)
sys.path.pop()
return imported
except ImportError:
logger.warn(
'Cannot import optional dependency "%s" for plugin cd.', module_name
Expand Down

0 comments on commit a5f25d0

Please sign in to comment.