Python

Circular imports

Në shqip: Importet rrethore

ShpjegimiSQ

Kur a.py importon b.py dhe b.py importon a.py, Python-i ngec — gabimi „partially initialized module“. Zgjidhje: zhvendos kodin e përbashkët në një modul të tretë, ose importo brenda funksionit.

EnglishEN

When a.py imports b.py and b.py imports a.py, Python gets stuck — the “partially initialized module” error. Fix: move the shared code to a third module, or import inside the function.

Si ta mendosh

Si dy njerëz që presin te dera që tjetri të hyjë i pari.

Lexoje në anglisht

Like two people at a door each waiting for the other to go first.

Terma të lidhur