Introduction to Python Modules

Introduction

A module is simply a Python file containing code — functions, classes, and variables — that you can reuse in other programs. Instead of rewriting the same square-root routine or random-number generator in every project, you import a module and call what you need. Python ships with a large standard library of modules such as math, random, os, and sys, and you can also write your own modules and install third-party ones with pip.

In this course, modules matter because they are the bridge between writing short scripts and building organized, maintainable engineering programs. The same import mechanics you learn here are what let you later open files, catch errors, and eventually pull in scientific packages. Understanding how Python finds a module at runtime — the module search path — also saves you hours of debugging the all-too-common ModuleNotFoundError.

As you watch, pay attention to the differences among the import forms: plain import module, selective from module import name, and aliasing with import module as alias. Notice how each form changes the name you actually type when calling a function, and watch for any discussion of where Python looks for files (the current directory, then installed library locations). Try typing each example yourself in a file rather than only in the interactive shell, since that is where search-path behavior becomes visible.

Video 1: How import works in Python | Python Tutorial - Day #44

CodeWithHarry · 12:42 · 354,415 views · 3y ago · captions — Watch on YouTube

About this video

A focused lesson on the mechanics of the import statement in Python, from a longer structured Python tutorial series. It is likely to walk through what happens when Python executes an import, the different import syntaxes available, and how imported names become accessible in your program. Expect live coding demonstrations rather than slides.

Why this video

Because this video is devoted specifically to how import works rather than just how to use it, it directly supports the harder subtopics of module loading and the search path, and CodeWithHarry's series format keeps the explanation sequential and beginner-friendly.

Video 2: PYTHON MODULES in 9 minutes: import, from, as, namespace, math, random and more

BitBoss · 9:22 · 87,316 views · 4y ago · captions — Watch on YouTube

About this video

A compact nine-minute overview that, per its description, covers what modules are and how to use the import, from, and as statements, along with namespaces and examples from the math and random modules. It is a fast tour that connects each import form to the naming rules that follow from it.

Why this video

This single video maps almost one-to-one onto the subtopics of this lesson — plain imports, selective imports, aliases, and namespaces — making it an efficient review or a strong first watch before the longer tutorials.

Video 3: Modules and Pip | Python Tutorial - Day #3

CodeWithHarry · 12:41 · 3,698,442 views · 3y ago · captions — Watch on YouTube

About this video

An early-series introduction that presents modules alongside pip, Python's package installer. It likely explains the idea of reusable code libraries, shows importing a standard library module, and then demonstrates installing and importing an external package.

Why this video

It supplies the practical context for why modules exist and where they come from, which rounds out the conceptual What Is a Module? subtopic; its very large view count reflects its usefulness as an accessible starting point.

About These Videos

These videos were chosen from YouTube on October 2, 2026. Each has captions; the player turns them on. Videos on YouTube can be changed or removed — if one no longer plays, tell your instructor. If a player does not appear, use its Watch on YouTube link.