Skip to content

Failure to resolve a specific import structure #4144

@elprans

Description

@elprans

Given the following module structure:

top
|-- __init__.py
|-- b
|   |-- __init__.py
|   `-- _b.py
`-- c.py

And the following module contents:

  • top/__init__.py:
from .b import *
from .c import *
  • top/b/__init__.py:
from ._b import *
  • top/b/_b.py:
import top
class Cls:
    pass
  • top/c.py:
from . import b
foo: b.Cls = None

mypy -m top fails to resolve b.Cls:

top/c.py:2: error: Name 'b.Cls' is not defined

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions