How to circularly import module in a package | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to circularly import module in a package

so i was just doing normal code and suddenly my program says something about circular import i have this on areo/base_loop.py ==== from .futures import Future ==== and this on areo/futures.py ==== from .base_loop import BaseLoop ==== how do i get around this so that i can import futures and base_loop simultaneously in each file and not get circular import error

26th Jun 2021, 8:41 AM
CutieRei
CutieRei - avatar
7 Answers
+ 1
oh also my __init__.py is from .futures import * from .base_loop import * from .handlers import *
26th Jun 2021, 9:21 AM
CutieRei
CutieRei - avatar
0
thanks but the solution doesn't seem to work do you want to see my code
26th Jun 2021, 9:11 AM
CutieRei
CutieRei - avatar
0
Not really, the solution's there though. You really should always post the code you have a question about, it'll help others see what the problem is.
26th Jun 2021, 9:14 AM
Slick
Slick - avatar
0
okay then let me send it, because its on my laptop
26th Jun 2021, 9:14 AM
CutieRei
CutieRei - avatar
0
these are the codes that import base_loop and themselves from base_loop
26th Jun 2021, 9:21 AM
CutieRei
CutieRei - avatar