Modularizing the code

We have been referring to modules in the earlier chapters. An explanation is in order. A single Python file with a .py extension is a module. You can use this module in some other source code using an import statement. The module name is the same as the file name, except the .py extension. For example, if the file name is knight.py, then import knight will import the module into your source file.

In this section, we will split the code in the attackoftheorcs_v1_1.py file into individual modules. You can find this file in the supporting code bundle for the previous chapter.

Attack of the Orcs v2.0.0

We will name this version 2.0.0. The major version is incremented to 2 as we are about to make some API level changes. The way ...

Get Learning Python Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.