Importing a service interface only proves that its Python definition exists. The working service may still be absent until the player logs in, enters battle, opens a feature, or finishes loading the relevant UI.
Concrete examples
- An inventory service may exist only after account synchronization finishes.
- A battle controller is unavailable while the player is still in the garage.
- A mode-specific service may appear only while that mode is active.
- A view service can disappear as soon as its window closes.
Resolve the service near the action that needs it, check that it is available, and avoid keeping context-specific implementations after leaving that context.
Access patterns
| Pattern | Resolution time | Best use |
|---|---|---|
dependency.descriptor(...) |
When the attribute is accessed | Long-lived objects that repeatedly use one controller |
dependency.instance(...) |
At the call site | Short helpers and context-sensitive access |
replace_none_kwargs |
When the decorated function is called | Injecting several optional-looking arguments consistently |
None of these patterns guarantees availability. Descriptor access can raise before the manager is configured, while direct resolution can raise when an implementation is not registered.
Read by topic
Choose a focused chapter. Complete examples and reference details are preserved on their topic pages.