diff --git a/pyttman/core/internals.py b/pyttman/core/internals.py index f02b6d4..5d0597e 100644 --- a/pyttman/core/internals.py +++ b/pyttman/core/internals.py @@ -163,3 +163,17 @@ def abilities(self, abilities): for ability in abilities: setattr(self, ability.__class__.__name__, ability) self._abilities.add(ability) + + def execute_plugins_before_start(self): + try: + for plugin in self.plugins: + self.loaded_plugins.ingest(plugin) + plugin.before_app_start(self) + except Exception as e: + raise PyttmanPluginException( + f"The plugin '{plugin.__class__.__name__}' " + f"caused the boostrap to fail.") from e + + def execute_plugins_after_stop(self): + for plugin in self.plugins: + plugin.after_app_stops(self)