diff --git a/modules/core/engine.py b/modules/core/engine.py index 37267c26441c9ae2dfd3171e7d3866ba3ee1655b..9b47200ca0d4b58b0937c0b4cfbcdc9535920844 100644 --- a/modules/core/engine.py +++ b/modules/core/engine.py @@ -44,6 +44,7 @@ class Engine(): """ The Engine. """ + instance = None engine_time_offset = 0.0 logger = None @@ -68,6 +69,9 @@ class Engine(): Args: config (AuraConfig): The configuration """ + if Engine.instance: + raise Exception("Engine is already running!") + Engine.instance = self self.config = config self.plugins = dict() self.logger = logging.getLogger("AuraEngine") @@ -178,6 +182,14 @@ class Engine(): return SU.timestamp() + Engine.engine_time_offset + @staticmethod + def get_instance(): + """ + Returns the one and only engine. + """ + return Engine.instance + + def terminate(self): """ Terminates the engine and all related processes.