from aiogram import Dispatcher from ocab_core.modules_system import ModulesManager class SingletonMeta(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: instance = super().__call__(*args, **kwargs) cls._instances[cls] = instance return cls._instances[cls] class Singleton(metaclass=SingletonMeta): dp: Dispatcher = None modules_manager: ModulesManager = None storage = dict()