def _load_lessons(self): """ Search the lessons/ package for lessons & store them in sorted order by priority :return: """ pkgs = [ n for _, n, _ in pkgutil.iter_modules(['lessons']) if n != 'base' ] for name in pkgs: exec(f'import lessons.{name}.plugin') responders = [ cls(self).set_profile(self.database['profile']) for cls in JenniferResponsePlugin.__subclasses__() if self._is_lesson_allowed(cls) ] self.notifiers = [ cls(self).set_profile(self.database['profile']) for cls in JenniferNotificationPlugin.__subclasses__() if self._is_lesson_allowed(cls) ] for r in (responders + self.notifiers): r.set_settings(self._get_settings_for_lesson(r)) self.responders = sorted(responders, key=lambda l: l.PRIORITY)