def load_modules(self):
        """Loads modules from specified path (self.path)"""

        for dirpath, dirs, files in os.walk(self.path):

            # Filter only Python files
            modules = [f for f in files if f.endswith(conf.modules['module_suffix'])]

            if len(modules) > 0:
                category_path = dirpath.split('/')[3:]
                modules_category = "/".join(category_path)

                # Add new category
                if modules_category not in self.categories:
                    self.categories[modules_category] = []

                # Seek for available modules
                for m in modules:
                    module = {}
                    module['name'] = m.split('.')[0]
                    module['path'] = os.path.join(dirpath, m)
                    module['disp_name'] = modules_category + conf.modules['path_delim'] + module['name']
                    module['load_name'] = module['disp_name'].replace('/', conf.modules['path_loadname_delim'])

                    # Open and load module
                    try:
                        module_file = open(module['path'], 'rb')
                        imp.load_source(module['load_name'], module['path'], module_file)
                        __import__(module['load_name'])

                        # Add to list(s)
                        self.categories[modules_category].append(module['load_name'])
                        self.modules[module['disp_name']] = module['load_name']
                    except:
                        traceback.print_exc()
dataset/ETHPy150Open dorneanu/appvulnms/src/core/framework.py/ModuleCollection.load_modules/original