You can use string literals; they will be evaluated later:
class Node(NamedTuple): name: str edges: List['Edge']
See PEP 484 Direct Link Section - Tooltip Type:
If the type hint contains names that are not yet defined, this definition can be expressed as a string literal, which will be resolved later.
For NamedTuple objects NamedTuple direct links are explicitly stored for later dereferencing:
>>> Node._field_types {'name': <class 'str'>, 'edges': typing.List[_ForwardRef('Edge')]}
which will check the type of validation can subsequently be dereferenced from locales and global variables:
>>> typing._eval_type(Node._field_types['edges'], globals(), locals()) typing.List[__main__.Edge]
source share