Circular model import issue in Django
Problem with circular imports, is there a way to solve that?
I have two applications (Catalog and Procurement) which holds information about Products, Categories etc.
Catalog is the customers "own" products, while Procurement are data from our customers suppliers.
In catalog.models, I have made a (global) import
from procurement.models import ProductPartNumber
Besides that, I have some local imports (from the procurement application) inside some other models in the catalog application.
I need to make the following import in the Supplier model in Procurement application:
from catalog.models import Category as CatalogCategory
And when I do that, I get an ImportError:
ImportError: cannot import name 'Category' from partially initialized module 'catalog.models' (most likely due to a circular import) (.../catalog/models.py)