0Pricing
Python Academy · Lesson

Creating and Importing Modules

Write your own modules and import them into other scripts.

Introduction

A module is a Python file containing functions, classes, and variables that can be imported into other scripts.

What is a Module?

Any .py file is a module. utils.py can be imported as: import utils. Python searches sys.path for modules.
import sys
print(sys.path[:3])

All lessons in this course

  1. Creating and Importing Modules
  2. The Python Standard Library
  3. Packages and __init__.py
  4. Installing Packages with pip
← Back to Python Academy