Note Returns a promise that resolves to the module namespace. Ideal for code-splitting, lazy loading, and conditional imports. Works at runtime, not just at the top of a file.
import module
from module import name
import module as alias
example
import json
from pathlib import Path
from collections import defaultdict, Counter
import numpy as np # common alias convention
data = json.dumps({"key": "value"})
print(data)
output
{"key": "value"}
Note Convention: standard library imports first, then third-party, then local. Separate groups with a blank line. Use isort to auto-format.