Skip to content

Document known flaws of lazy loading external modules #55

Closed
@agucova

Description

@agucova

As I described here, lazy loading external modules can break modules silently, even to other libraries, in weird or unexpected ways. I imagine you're already aware of this.

Given that there doesn't appear to be any reliable solution to this, I think it would be useful to at least document this flaw, so users can at least notice when something like this happens.

To reproduce

import lazy_loader as lazy
plt = lazy.load('matplotlib.pyplot')
plt

# This code can be in an arbitrary module
import matplotlib
import matplotlib.pyplot

matplotlib.pyplot

Gives:

AttributeError: module 'matplotlib' has no attribute 'pyplot'

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