[capi-sig] Problem with a sub-module

Remi K. remi.k2620 at gmail.com
Sat Dec 29 17:56:06 CET 2007

Hi everybody,
I have two modules:
    m1 = Py_InitModule3("PySFML", NULL, "Python binding for sfml (Simple
Fast Media Library)");

    m2 = Py_InitModule("sf", module_methods);

Then I add a few classes, like Color, to m2.
Then I make the first module contain the second one:
    PyModule_AddObject(m1, "sf", m2);
This way I can do:
from PySFML import *
MyColor = sf.Color(0,0,0,255)
I would like to be able to do this:
from PySFML.sf import *
MyColor = Color(0,0,0,255)
However, it does not work: "ImportError: No module named sf"

First, is what i want to do "correct"? I mean, is it non-standard?
And if it is correct, how can I do it?

Thanks in advance.

More information about the capi-sig mailing list