Python · Modules & Packages

Modules a.py and b.py each do import of the other at the top, then use one of its names immediately. What goes wrong?

Answer locked. Get the free KnowCard app to reveal it — plus spaced-repetition review so it actually sticks.

Get it on App StoreGet it on Google Play

This is one card from the KnowCard library — thousands more across SAP, Linux, Python and more. In the app you get the answer, AI explanations, and cards that come back right before you would forget them. Free to start on iOS, Android or the web.

More in Modules & Packages

After import math, why does calling sin(math.pi) (without the math. prefix) raise NameError?
What does this print? ``` import math as m print(m.sqrt(9)) print(math.sqrt(9)) ```
What does this print? ``` pi = 1234 from math import * print(pi) ```
When you do from somemod import *, which of a module's names are NOT imported by default?
Why is from os import * considered an anti-pattern even though it saves typing the os. prefix?
What does this print? ``` import mymod # prints "loading" on import import mymod import mymod ``` (mymod has a top-level `print("loading")`)

Start learning today

Free to start — download the app or use it in your browser.

Get it on App StoreGet it on Google Play