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
- Creating and Importing Modules
- The Python Standard Library
- Packages and __init__.py
- Installing Packages with pip