Skip to content

submodules overshadow imports of the same name #124

@machow

Description

@machow

If a module's __init__.py has a submodule, foo.py. Then importing a function of the same name from it, seems to keep the module name, rather than the function. This seems like a slight mismatch from dynamically importing, which keeps the function instead.

from griffe.loader import GriffeLoader

loader = GriffeLoader()
mod = loader.load_module("some_package")
mod.members

# output:
#  {'foo': <Module(PosixPath('some_package/foo.py'))>}

Example files

some_package/__init__.py

from foo import foo

some_package/foo.py

def foo(): pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions