Version-Specific Features
Python 3.15 — Explicit lazy imports
Module-scope lazy imports defer loading until the imported binding is used. Import side effects and errors can move to that later point. Star imports, future imports and lazy imports inside functions or try blocks are not allowed. Requires Python 3.15 or the relevant build; example is not executed locally.
Formal Syntax & Structure
python syntaxpython
lazy import module / lazy from module import nameReturn Value
Feature-specific
No single return type; see the example and feature description.
Working Example
Example Snippetpython
lazy import jsonprint(json.loads('[2, 4]'))