__import__() — Easy Examples
Low-level function invoked by the import statement
Basic __import__() usage
Simple demonstration of the __import__() built-in function.
python
mod = __import__("math") print(mod.pi) print("Prefer 'import math' in normal code")
__import__() is a built-in function that low-level function invoked by the import statement.
__import__() with different inputs
Calling __import__() with various argument types.
python
# More __import__() examples print("__import__() is a Python built-in function") print(f"Type: {type(__import__)}")
__import__() accepts different types of arguments and produces corresponding results.
Want to try these examples interactively?
Open Easy Playground