I sent this PR to the lazy_loader repo, that has the potential to greatly simplify the syntax, but it could benefit from some feedback before it is put into the package: Add context manager functionality using hooks by vnmabus · Pull Request #121 · scientific-python/lazy-loader · GitHub. I see here many people interested in this topic, so it would be good if you could add your feedback to the PR, to detect potential problems early on.