[Cython] Intra-package reference not working with cimport
Stefan Behnel
stefan_ml at behnel.de
Mon Nov 3 12:58:52 CET 2008
Stephane DROUARD wrote:
> Intra-package reference
> (http://docs.python.org/tutorial/modules.html#intra-package-references)
> does not work with cimport.
>
> foo.py:
> def foo():
> pass
>
> bar.py:
> import foo
> foo.foo()
>
> If I move foo.py and bar.py into a package and import pkg.bar, it works
> under Python as well as under Cython.
>
> But if I "cimport foo" (cdef foo), it works when not in a package, but
> fails to import foo when in pkg.
Did you read the documentation on sharing declarations between extension
modules? Did you declare foo() public?
Stefan
More information about the Cython-dev
mailing list