No module named error. How to import function from .pyx file in python from different directories rooted to same directory?

642 views Asked by At

I am running code from main.py. Following is my directory structure:

I'm using Python 3.6 and Linux.

PackA
     PackB
          PackC
               _main.py
          PackD 
               cython_file.pyx
                         def func()   # function defined here. 
               cython_file.pxd
               __init__.py   
                     func()           # function call. 

The Package pyximport is installed used by Cython.

I'm importing the cython file in __init__.py using:

from cython_file import func

Error: ImportError: cannot import name 'func'

Where am I doing wrong?

0

There are 0 answers