title: Cross module dependencies in Boost Python
body: <p>Suppose I have two boost python modules that are defined as follows. Module A:</p>
  
  <pre><code>class SomeClass {
  public:
      SomeClass() {}
      ~SomeClass() {}
  };
  BOOST_PYTHON_MODULE(A)
  {   
      class_&lt;SomeClass&gt;("SomeClass");
  }
  </code></pre>
  
  <p>And module B:</p>
  
  <pre><code>class AnotherClass {
  public:
      AnotherClass() {}
      ~AnotherClass() {}
      void func(SomeClass&amp; sp) {}
  };
  BOOST_PYTHON_MODULE(B)
  {   class_&lt;AnotherClass&gt;("AnotherClass")
          .def("func", &amp;AnotherClass::func)
      ;
  }
  </code></pre>
  
  <p>Module B has a dependency on module A (i.e. it uses <code>SomeClass</code> from module A). Now, I execute the following python script:</p>
  
  <pre><code>import A
  import B
  obj1 = A.SomeClass()
  obj2 = B.AnotherClass()
  obj2.func(obj1)
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\bladiebla\script.py", line 8, in &lt;module&gt;
      obj2.func(obj1)
  ArgumentError: Python argument types in
  AnotherClass.func(AnotherClass, SomeClass)
  did not match C++ signature:
  func(class AnotherClass {lvalue}, class SomeClass)
  </code></pre>
  
  <p>It seems that Python does not automatically translate classes between modules. Does anyone have an idea how to solve this?</p>