More About Using ModulesΒΆ
The first thing we need to do when we wish to use a module is perform an import
.
In the example above, the statement import turtle
creates a new name, turtle
, and makes it refer to a module object.
In order to use something contained in a module, we use the dot notation, providing the module name and the specific item joined together with a “dot”.
- For example, to use the
Turtle
class, we sayturtle.Turtle
. - You should read this as: “In the module turtle, access the Python element called Turtle”.