import
`import` brings a module into your program so you can use what it holds by writing `module.name`.
Used in 114 lessons of the course, from 00.01.
A module is a Python file with functions, classes and values ready to use. With import platform you tell Python: "find the platform module and give me access to it".
After the import, the name platform exists in your program. To use something inside it, you write the module name, a dot, and the name you want: platform.system().
It is written this way for a reason: the prefix tells you where each thing comes from. If two modules have a function with the same name, they don't clash.
Python loads the module once and keeps it. If you import it again, it reuses the one already loaded.
In the course you will see import at the top of almost every lesson, starting with import platform in 00.01. By convention it goes at the top of the file, so you can see at a glance what the file needs.
Reach for it when: you need something that isn't built in by default, like the maths in `math` or the system information in `platform`.
Examples
Common mistake
import math print(sqrt(16))
Why: `import math` creates the name `math`, not `sqrt`. Python can't find `sqrt` on its own.
How to write it: Write math.sqrt(16), or use from math import sqrt.
Common mistake
import maths print(maths.pi)
Why: The module is called `math`, not `maths`. Python can't find any module with that name.
How to write it: Check the spelling of the name. If it's an external package, install it first.
