From 37704e3eeb957fb6b35e0a8cf6b5dd2fd14c5460 Mon Sep 17 00:00:00 2001 From: Daniel Goldberg Date: Wed, 30 Oct 2019 15:23:37 +0200 Subject: [PATCH] Slightly cleaner usage of importlib, making sure we import the correct module --- monkey/infection_monkey/utils/load_plugins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monkey/infection_monkey/utils/load_plugins.py b/monkey/infection_monkey/utils/load_plugins.py index bb075e5e8..8516d8a02 100644 --- a/monkey/infection_monkey/utils/load_plugins.py +++ b/monkey/infection_monkey/utils/load_plugins.py @@ -26,7 +26,7 @@ def get_instances(base_package_name, base_package_file, parent_class): # Go through all of files for file in candidate_files: # Import module from that file - module = importlib.import_module(base_package_name + '.' + file) + module = importlib.import_module('.' + file, base_package_name) # Get all classes in a module # m[1] because return object is (name,class) classes = [m[1] for m in inspect.getmembers(module, inspect.isclass)