Wildcard import
A wildcard import is an import statement that brings eligible exported names from a module, package, object, or namespace into the importing scope.
The Quick Python Book, Fourth Edition
A wildcard import is an import statement form that brings the names exported by a module directly into the importing namespace.
- How it is used
- Imports a module’s exported names directly for concise access, especially in interactive shells or modules designed for wildcard use.
- How deep it goes
- Explains syntax, public-name filtering, __all__, collisions, private-name exceptions, and nonrecursive package behavior without implementation internals.
- Examples
- Demonstrates modtest.py visibility, math–cmath collisions, and package exports through mathproj and its comp subpackage.
- What you can do after
- Apply it via Python import statements while controlling exported names and recognizing collisions, hidden names, and package boundaries.
Read how The Quick Python Book, Fourth Edition explains wildcard import →
Python Workout, Second Edition
A wildcard import imports the names designated for export by a module rather than naming each imported name individually.
- How it is used
- Uses wildcard syntax to import a module’s designated exports without naming each imported name individually.
- How deep it goes
- Defines __all__ through a focused exercise, but does not develop wildcard-import internals or broader trade-offs.
- Examples
- Uses module stuff with variables a, b, c and functions foo, bar to demonstrate selective exports.
- What you can do after
- Build it from scratch by defining __all__ to control names imported with wildcard syntax.
Read how Python Workout, Second Edition explains wildcard import →
Also covered in
What to know first
- functionA function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.
- PythonPython is a high-level, general-purpose, dynamically typed programming language with readable syntax and support for multiple programming paradigms.
- bindingName binding is the association of an identifier with the program entity or value it denotes.
Related concepts
- __all__configured by · __all__ is a module-level sequence of names specifying which names a Python module exports for wildcard imports.
- import statementkind of · An import statement is a source-code declaration that makes definitions from another module, package, or namespace available in the current program context.
- namespaceuses · A global namespace is a top-level naming context that binds identifiers defined at the outermost level and distinguishes them from names in nested scopes.
- use declarationuses · A Rust use declaration brings names from a module or crate path into scope for access without qualifying them by that path.
Questions about wildcard import
What is wildcard import?
A wildcard import is an import statement that brings eligible exported names from a module, package, object, or namespace into the importing scope.
Which Manning books explain wildcard import?
The Quick Python Book, Fourth Edition and Python Workout, Second Edition.
What should I know before learning wildcard import?
Manning books that teach wildcard import usually introduce function, Python and binding first.
What is wildcard import a kind of?
Wildcard import is a kind of import statement. An import statement is a source-code declaration that makes definitions from another module, package, or namespace available in the current program context.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

