1# models.py
2from services import UserService # triggers services.py to load
3
4class User:
5 def save(self):
6 UserService.audit(self)
7
8# services.py
9from models import User # models.py is mid-load here
10
11class UserService:
12 @staticmethod
13 def audit(user):
14 print(f"Auditing {user}")
15
16 def create(self, data):
17 return User(**data) # AttributeError: partially loaded module
no lines flagged
#020PracticeHard25 min · 200 XP
Circular Import Causes AttributeError
Two modules import each other at the top level. One module sees an incomplete version of the other, causing an AttributeError at runtime.
Flagged linesNo lines flagged yet
What's wrong?
Flag a line or write a note to submit.