Introduction and setup
Modules and packages
Virtual environments and package management
Course Project: building a package
Wrapping up

Modules vs classes

Especially when you’re familiar with other object-oriented programming languages, like Java or C#, it is completely normal to wonder how modules compare to classes. They both group functionality, after all. There are significant differences, though, and there are good reasons for Python to have both modules and classes.

A module groups similar functionality and code into one place. A module, for example, might contain classes, functions, and constants that can be used to connect to a particular type of database. There only needs to be one instance of this module, also called a singleton. You should see modules as a way to organize your code within your project.

A class models your problem domain. It provides a blueprint for one or more objects. E.g., a student class holds student data and related functions that work on that data. There can be many students, and hence there can be many student objects at the same time.