class ScreenshotManager: _instance = None def __new__(cls): if not cls._instance: print( f"Creating new instance of ScreenshotManager from {__file__}") cls._instance = super(ScreenshotManager, cls).__new__(cls) return cls._instance def __init__(self): if not hasattr(self, 'initialized'): # This prevents reinitialization print(f"Initializing ScreenshotManager, id: {id(self)}") self.screenshots = {} self.initialized = True def add_screenshot_path(self, scenario_name, path): self.screenshots[scenario_name] = path print(f"Added path for {scenario_name}: {path}") def get_screenshot_path(self, scenario_name): print(f"Current paths: {self.screenshots}") return self.screenshots.get(scenario_name)