title: Python and SWIG - Multiple modules in a single .pyd (.so)
body: <p>I am writing a C++ extension for Python using SWIG. From what I understand of Python and SWIG, each module must have its own .pyd file. For example, if I have a module named 'mymodule', there should be a corresponding '_mymodule.pyd' file.</p>
  
  <p>In my particular case, I would like to have only one 'pyd' file and multiples modules linking to it.</p>
  
  <pre><code>mypackage/
  mypackage/__init__.py
  mypackage/module1.py
  mypackage/module2.py
  </code></pre>
  
  <p>I don't want to have to maintain multiples .pyd, so I can put my interface (.i) files all under the same project in VS2010.</p>
  
  <p>Edit: So far, the only way I have been able to make it work is by duplicating my 'pyd' file into two new files: _module1.pyd and _module2.pyd. But I don't like this solution, because I need to duplicate the 'pyd' file of 30 Mo unnecessarily. I would prefer the modules to link to one '_package.pyd' file.</p>
  
  <p>What is the best way of doing that?</p>