Skip to content

support transitive imports #1214

@KotlinIsland

Description

@KotlinIsland

Summary

here the module package.b is loaded via an import in another module, mypy supports this feature, pyright does not, what do you think?

my-app/
├─ package/
│  ├─ b.py
│  ├─ __init__.py
├─ main.py
├─ mod.py
# main.py
import package
import mod

reveal_type(package.b)
 # ty: Type `<module 'package'>` has no attribute `b`
 # mypy: "types.ModuleType"
 # runtime: `package.b`
# mod.py
import package.b

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    importsModule resolution, site-packages discovery, import-related diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions