-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
Description
Problem
When importing a module setup with apipkg, successive imports, even if in different files, trigger a full load. I thought it would only load when actually used. I have some anecdotal observation that the behavior is intermittent, but when I put together this test code, it reproduces every time
How to Reproduce
system info:
MacOS 14.5
Python 3.12.4
Consider the following filetree
mypkg/
- module.py
- lazy.py
with contents:
# lazy.py
import apipkg
apipkg.initpkg(__name__,{
"module": "mypkg.module",
})
# module.py
print("module loaded")
then in a terminal:
> python
>>> import mypkg.lazy.module
>>> import mypkg.lazy.module
module loaded