Structuring Our Code and Add-Ons
The add-ons we have created so far consist of single Python files. That’s ok, but to deal with complexity, we can split our code into related modules contained in the same directory.
Writing modules that interact with each other rather than a single huge file makes design and maintenance easier, allowing us to shift our focus to single aspects of our task.
The presence of non-code files, such as images and other media, can be another reason for adopting a folder structure. This is because sharing one folder is more practical than handling the Python script and the data separately.
In this chapter, you will learn how to code across separate modules of a package and blend everything using the import system. The packaged add-on that we are going to create will be easier to distribute, read, and maintain, and it will be possible to grasp the functionality of its different parts by just looking at the filenames.
This chapter will cover...