<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>ImportError with cimport within package</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>Hi all,<BR>
<BR>
I'm trying to create package compiled with Cython. It compiles fine but when I try to import it I get an ImportError exception. Here is a simplifed version which generates the same error:<BR>
<BR>
The structure of the compiled package:<BR>
&nbsp; package/<BR>
&nbsp;&nbsp;&nbsp; __init__.py&nbsp;&nbsp;&nbsp; - Empty<BR>
&nbsp;&nbsp;&nbsp; module_A.pyd<BR>
&nbsp;&nbsp;&nbsp; module_B.pyd<BR>
&nbsp;<BR>
Content of the Cython modules:<BR>
&nbsp; module_B.pyx<BR>
<BR>
&nbsp;&nbsp;&nbsp; cdef class BaseClass:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp; module_B.pxd<BR>
<BR>
&nbsp;&nbsp;&nbsp; cdef class BaseClass:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pass<BR>
&nbsp;&nbsp;&nbsp;<BR>
&nbsp; module_A.pyx<BR>
<BR>
&nbsp;&nbsp;&nbsp; cimport module_B<BR>
<BR>
&nbsp;&nbsp;&nbsp; cdef class SubClass(module_B.BaseClass):<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>
<BR>
Content of my test script:<BR>
&nbsp; from package.module_A import Subclass<BR>
<BR>
When I run the test script I get &quot;ImportError: No module named module_B&quot;. I works if I put module_B.pyd in the same folder as the test script. I don't understand why since module_A which contains the subclass of the class in module_B is in the same folder as module_B, and there exist no Python imports from the module (which I thought would work as well).<BR>
<BR>
Any suggestions?<BR>
<BR>
(I use Cython 0.10.3, Python 2.5.1 and MSVS C++ 7.1)<BR>
<BR>
Best regards,<BR>
Mikael Arvids</FONT>
</P>

</BODY>
</HTML>