Closed
Description
Mypy doesn't recognize access to a named tuple defined in another module within an import cycle, if the other module is processed later than the module that contains the reference to the named tuple.
Example:
# a.py
from collections import namedtuple
from b import f
N = namedtuple('N', 'a')
# b.py
import a
def f(x: a.N) -> None: ... # Invalid type "a.N"
A potential fix is to process references to types in a later phase of semantic analysis than type definitions.
This is related to #3016.