Importing Modules in Python

Joseph Mellor
10 min readMar 2, 2023

In this article, we’ll talk about how to get and use code that other people have written in your own programs and libraries.

Image made by me using the python logo, cool-retro-term, vim, and GIMP.

With the core functionality introduced in the previous articles, we can do pretty much anything we want to do. Doing things from scratch, however, takes either a lot of time or a lot of experience.

For example, say you wanted to make a program that could generate math-based animations like the ones in my other articles. At a minimum, you would need to

  • convert mathematical descriptions of objects into vertices, paths, and planes,
  • render those vertices, paths, and planes,
  • render text,
  • render math equations and formulas,
  • allow users to control and plan out scenes,
  • and allow users to generate multiple frames that you can then combine into an image.

Even in this description, I’m compressing a lot of implementation details and leaving out some features. While it is possible for one person to do all these things, it’s rarely necessary because people have already done some of these things and given out free access to the code to everyone. In this article, we’re…

--

--

Joseph Mellor

BS in Physics, Math, and CS with a minor in High-Performance Computing. You can find all my articles at https://josephmellor.xyz/articles/.