Import Pitfalls

Let's discuss Import pitfalls and how they can be fixed.

Common import pitfalls

There are some very common import pitfalls that programmers fall into. We’ll go over the two most common here:

  • Circular imports
  • Shadowed imports

Let’s start by looking at circular imports.

Circular imports

Circular imports happen when we create two modules that import each other. Let’s look at an example as that will make it quite clear what we are referring to. Put the following code into a module called a.py ...

Access this course and 1400+ top-rated courses and projects.