There's no built‐in way to automatically “extract” the id type (T) from your concrete MyObj subtype in Python’s type system. In other words, you cannot write something like:
class MyObjMgr2(Generic[TObj]): def get_by_id(self, obj_id: T@TObj): # <-- No syntax exists to pull out T from TObj[T] ...
Currently (PEP 484 and later), if you want your manager to know about the type of the id attribute, you have to supply it explicitly as you did in your first version. However, even with that approach you still must supply both type parameters when instantiating your manager. In short, the current state of Python’s generics does not support inferring T from a concrete type parameter (i.e. from MyObjImplInt, which is actually MyObj[int]) automatically. You must either supply both parameters explicitly or change your design (for example, by storing the id type as a class attribute) to work around this limitation.
tldr No, there isn’t a way to infer T from TObj[T] automatically—you have to provide both type parameters explicitly.
This is just a limitation of the current Python type system.