File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
examples/A21_import_system Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 11# Shows how to enforce and use absolute imports.
22# ------------------------------------------------------------------------------
33# Example script demonstrating absolute imports.
4+ from __future__ import absolute_import
45# Using absolute imports
56import asyncio
67
7- # Enforce absolute imports
8- from __future__ import absolute_import
9-
108# Absolute imports
119from foo .api .submodule1 import func1
1210from foo .core .submodule2 import func2
Original file line number Diff line number Diff line change 1+ # Shows how to use relative imports within a package.
2+ # -----------------------------------------------------------------------------
3+ # Demonstrates importing modules from the current package using relative syntax.
4+
5+ from .foo .api .submodule1 import func1
6+ from .foo .core .submodule2 import func2
7+ # Relative imports are scoped to packages.
8+
9+ # Call the imported functions
10+ func1 ()
11+ func2 ()
You can’t perform that action at this time.
0 commit comments