bundles / traitlets latest / traitlets / config / configurable / SingletonScope / add
function
traitlets.config.configurable:SingletonScope.add
Signature
def add(self, inst: SingletonConfigurable) → NoneSummary
Pre-seed the registry with an instance you built yourself, so that .instance() returns that object inside the scope.
Extended Summary
Writes through to the singleton parents of type(inst), the same way the classic global path does, so a subclass instance is also returned when resolving via an ancestor class. This is the only way to control which object in-scope .instance() calls receive, since they otherwise construct a fresh one.
Aliases
traitlets.config.SingletonScope.add