I'm using Django Rest Framework for API where I need to use methods from one model into another. But, this results in
ImportError: cannot import name '...' from partially initialized module '...' (most likely due to circular import)
My models samples are as follows:
Model A
from ..B.models import B
Class A:
@classmethod
def foo():
b = B()
b.bar()
Model B
from ..A.models import A
Class B:
@classmethod
def bar():
a = A()
a.foo()
I understand the error is being caused to due to ciruclar import. Is there any way to import methods in each other's model?