2
This code is not valid, you cannot have cyclic imports and dependencies. This is not even true for Django Rest Framework by Python in general. You have to change your design to remove this cyclic dependency.
A circular dependency in any language, is an infinite recursion.
Look at this library – https://github.com/heywbj/django-rest-framework-recursive/tree/master/rest_framework_recursive. This can be used to emulate circular dependency like in a tree or linked list.
But I would still suggest you to re consider your design. Read why circular dependency is a sign of poor design.
If that is not possible, put interdependent components into the same module.
Source:stackexchange.com