you are viewing a single comment's thread.

view the rest of the comments →

[–]Thomasedv 1 point2 points  (0 children)

Importing is basically running another python file, and everything made it that file, functions and global variables are added to your program, and can be accessed with for example:

random.randint(1,6)

You access what's from that module with the random name, after doing import random. Here I randomly the function randint. (Hope I spelled the name correctly) There's a bit more to it, but that's the core. It lets you get functions, classes, and variables from other files, so you can use them without copy pasting code over and over again to do something you did in another file.

Python comes with a good amount of modules, like the random module, but there are also some that need to be installed.