Circular imports and annotations
<p>If I want to use annotations in both classes in the different modules is cross?</p>

<pre><code>from BModule import B

class A:
  def method(self, b: B):
     pass
</code></pre>

<p>~</p>

<pre><code>from AModule import A

class B:
  def method(self, a: A):
     pass
</code></pre>

<p>I got a <code>ImportError: cannot import name 'B'</code>? But how if I need annotate this, what to do?</p>

<p>Also if I just import AModule\BModule and use class as attribute of module <code>AModule.A</code> I got <code>AttributeError: module 'BModule' has no attribute 'B'</code></p>

<p>What is forcing the dependency? It seems to me that in this case, any method of <code>A</code> that takes a <code>B</code> could be implemented as a method on <code>B</code> that takes an <code>A</code>, so make one of the classes the "main" class and use that class to operate on objects of the other class, if that makes sense?</p>

python import annotations python-import circular-dependency