How do I compile a C-Python module such that it is local to another? E.g. if I have a module named "bar" and another module named "mymodule", how do I compile "bar" so that it imported via "import mymodule.bar"?
(Sorry if this is poorly phrased, I wasn't sure what the proper term for it was.)
I tried the following in setup.py, but it doesn't seem to work:
from distutils.core import setup, Extensionsetup(name='mymodule',version='1.0',author='Me',ext_modules=[Extension('mymodule', ['mymodule-module.c']),Extension('bar', ['bar-module.c'])])
Edit
Thanks Alex. So this is what I ended up using:
from distutils.core import setup, ExtensionPACKAGE_NAME = 'mymodule'setup(name=PACKAGE_NAME,version='1.0',author='Me',packages=[PACKAGE_NAME],ext_package=PACKAGE_NAMEext_modules=[Extension('foo', ['mymodule-foo-module.c']),Extension('bar', ['mymodule-bar-module.c'])])
with of course a folder named "mymodule" containing __init__.py
.