In this recipe, you will learn how to take the code you create and put it into its own Python modules. We will take the code from the previous recipe, which helped us track button press events, and place it into its own dedicated module.
We will then import this newly created module into our main Python script and use its class definition to track button presses. This can be a very useful approach when you start working on large projects and want to split up your code into different modules. It can also be helpful when you find a useful module that you would like to incorporate into your own project.