Organizing Code in Modules
Learn how to organize code in the form of modules.
We'll cover the following...
The Python module is an important focus. Every application or web service has at least one module. Even a seemingly “simple” Python script is a module. Inside any one module, we can specify variables, classes, or functions. They can be a handy way to store the global state without namespace conflicts.
Example
For example, we have been importing the Database
class into various modules and then instantiating it, but it might make more sense to have only one database
object globally available from
the database
module. The database
module might look like this:
Access this course and 1400+ top-rated courses and projects.