Skip to content

How to resolve importing a function from a module with same name #828

Closed
@henrylhtsang

Description

@henrylhtsang

Hi, in our repo, we have a python file in torchrec/distributed/shard.py that contains a function shard. We also want to keep the shard function inside torchrec/distributed/init.py, which we did by from torchrec.distributed.shard import shard.

However, we got a pyre error
torchrec/distributed/init.py:39:0 Undefined import [21]: Could not find a module corresponding to import torchrec.distributed.shard. A definition with that name exists but it's a function.

Any idea on how to resolve?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions