Python 3.15 introduces explicit lazy imports through PEP 810, giving developers a new way to control when modules are actually imported.
Instead of loading every dependency when a program starts, lazy imports allow Python to defer the work until the imported name is actually needed.
For large applications with many dependencies, this could make application startup significantly faster.
What Are Lazy Imports?
Traditionally, when Python encounters an import such as:
import pandasimport requestsimport jsonthe modules are imported immediately.
With Python 3.15's explicit lazy import syntax, you can write:
lazy import pandaslazy import requestslazy import jsonThe modules aren't fully loaded at that point. The import is deferred until the corresponding name is actually used.
The basic idea is:
Don't pay the cost of loading a dependency until you actually need it.
Why Does This Matter?
Modern Python applications can have extremely large dependency trees.
A single application might depend on:
- Pandas
- NumPy
- Cloud SDKs
- Database drivers
- Machine learning frameworks
- LLM providers
- Vector databases
- Observability tools
- Authentication libraries
- Optional integrations
But a particular execution path might only use a small percentage of those dependencies.
Traditional imports can make the application pay the startup cost for dependencies that may never be used.
Lazy imports provide a way to avoid some of that unnecessary work.
Python 3.15 Lazy Import Example
Traditional imports:
import jsonfrom pathlib import Pathimport pandas as pdimport requestsPython 3.15:
lazy import jsonlazy from pathlib import Pathlazy import pandas as pdlazy import requestsThe important difference is the lazy keyword.
The actual module loading is deferred until the imported name is accessed.
How Much Faster Can It Be?
PEP 810 reports significant improvements in certain real-world workloads.
The reported results include:
Up to 50–70% faster startup
Some command-line workloads can see substantial reductions in startup time when many imported dependencies aren't actually needed.
Around 30–40% lower memory usage
Large applications can also benefit from reduced memory consumption when unused dependencies are no longer loaded immediately.
However, these numbers aren't guarantees for every Python application.
The actual improvement depends heavily on the application's dependency tree and which modules are eventually used.
Where Lazy Imports Can Make the Biggest Difference
Lazy imports are particularly interesting for applications that have:
Large dependency trees + small execution paths
For example, imagine a CLI application with 100 dependencies.
A particular command might only need 10 of them.
With traditional imports, many of those dependencies may be initialized before the application can even execute the command.
With lazy imports, Python can defer some of that work until it becomes necessary.
This can be especially useful for:
- CLI applications
- Developer tools
- Large Python services
- Plugin systems
- Data science applications
- AI/ML applications
- Applications with optional features
Lazy Imports and AI/GenAI Applications
This is particularly interesting for modern AI applications.
A single AI application might integrate with:
LLM providers
↓
Vector databases
↓
Cloud SDKs
↓
Database drivers
↓
Observability
↓
Optional integrationsBut an individual execution may only use one or two of these components.
For example, an application might support OpenAI, Anthropic, multiple vector databases, AWS, Azure, and several observability platforms.
Loading everything during startup can be expensive.
Lazy imports give developers another tool for controlling that startup cost.
Lazy Imports vs Importing Inside a Function
Python developers have traditionally used this technique:
def process_data(): import pandas as pd return pd.DataFrame(...)This provides function-level deferral.
Explicit lazy imports are different:
lazy import pandasThey are designed for module-level imports.
Therefore, lazy imports don't completely replace the traditional technique of importing inside a function.
If you need very specific function-level control, a local import can still be appropriate.
What About __lazy_modules__?
Python 3.15 also provides mechanisms such as:
__lazy_modules__This can help projects adopt lazy imports without necessarily rewriting every import statement individually.
That can be particularly useful for larger existing codebases where changing hundreds or thousands of import statements isn't practical.
There Is a Trade-Off
Lazy imports aren't a free performance upgrade.
One important consequence is that some problems can be detected later.
With traditional imports:
import some_modulean import failure generally happens during startup.
With a lazy import:
lazy import some_modulethe failure may not occur until the imported name is actually accessed.
That means errors can move from startup time to usage time.
Import-time side effects can also behave differently because module initialization is deferred.
Developers therefore need to consider whether a dependency is safe and appropriate to import lazily.
Lazy Imports Are Optional
One of the most important points about Python 3.15's feature is that lazy imports don't replace normal imports.
Traditional imports remain the normal behavior.
You explicitly opt into lazy importing when you want it:
lazy import moduleThis makes the feature more of a developer control mechanism than a change to Python's entire import system.
Python 3.15 Release Timing
Python 3.15 was originally scheduled for a October 1, 2026 final release.
However, last-minute issues related to lazy imports resulted in an additional release candidate being prepared.
Python 3.15.0rc3 was released on October 2, with the final release scheduled for:
October 9, 2026
It's an interesting detail because one of Python 3.15's headline features was also involved in the final release delay.
Should You Use Lazy Imports?
It depends on your application.
Lazy imports are worth investigating if your project has:
- A large dependency tree
- Slow startup times
- High memory usage
- Many optional dependencies
- Large CLI tools
- Plugin architectures
- Features that are rarely used
For a small Python script with a handful of dependencies, the benefit may be negligible.
For a large application, however, reducing unnecessary initialization can have a meaningful impact.
The Bigger Picture
Python has historically made it easy to import modules, but developers have had fewer language-level options for explicitly controlling when those imports become active.
PEP 810 changes that.
The goal isn't:
Make every Python import lazy.
The goal is:
Give developers more control over when dependency costs are paid.
For increasingly large Python applications — particularly applications combining data science, cloud services, AI, databases, and multiple optional integrations — that control could become increasingly valuable.
Final Takeaway
Python 3.15's lazy imports are not about changing how every Python program works.
They're about giving developers another performance tool.
If your application spends significant time loading dependencies that aren't immediately needed, explicit lazy imports could help reduce:
Startup time ↓
Memory usage ↓
Unnecessary initialization ↓
while giving developers more control over how and when dependencies are loaded.
Python's import system just became a little more flexible — and Python 3.15 is getting interesting.



