13.01
Completed
Python Modules & Imports Python Modules & Imports

Learn what Python modules are, where they come from, and how to reuse code with import and module.name.

Python Modules & Imports

Sounds useful?

Jump into the interactive version.

No setup. No account. Just Python.

Interactive Python lesson

Python Modules & Imports

Python comes with useful code you can reuse instead of rebuilding every tool yourself. This Block introduces modules as named collections of reusable code and shows how to bring one into a program with import. You will use the standard-library math module, call math.sqrt(), and see why the module prefix keeps names clear.

What you will learn:

  • What modules are and why reusable code matters
  • Where modules come from: Python's standard library, installed third-party code, and your own Python files
  • Import a module with import module_name
  • Access functions with module_name.tool_name
  • Place imports clearly and fix common spelling, syntax, and missing-prefix mistakes

Leave with a simple mental model for imports and a practical pattern you can reuse whenever Python already has the tool you need.

> Start now 107 cards · about 9 min

Ready to practice this in the browser?

> Play now