0

I am trying to run GitHub code, where facing issues with importing files having extention .c, .cpp, .hpp, .pyx in init.py file.

Here's the file in which we have to import bbox, cython_nms and gpu_nms modules:

Figure.1

These are residing in the same folder as init.py is:

enter image description here

But it gives this err:

enter image description here

Holding two questions:

  1. How to import other then .py extention modules in .py file?

  2. Importing two or more modules having same name but different extensions using one import statement.

For instance:

from . import bbox

where two modules named with bbox in the same folder bbox.c and bbox.pyx.

maryam mehboob
  • 338
  • 5
  • 17
  • Does this answer your question? [How do I import function from .pyx file in python?](https://stackoverflow.com/questions/7508803/how-do-i-import-function-from-pyx-file-in-python) – Mox Feb 28 '21 at 06:28
  • @Mox Thanks, however I have to import `from . import bbox` where there are two modules with **bbox** having different extention **.c** and **.pyx** in the same folder, in the link you shared its specific to .pyx extention and infact its not working. – maryam mehboob Feb 28 '21 at 06:41
  • 1
    You can't import C code directly. You have to compile the C code to a python extension. – Miles Budnek Feb 28 '21 at 07:18
  • The C code is not a module in the sense that you seem to be imagining. – Mad Physicist Feb 28 '21 at 08:22
  • @Miles Budnet, Thanks. I have to try this. – maryam mehboob Feb 28 '21 at 08:25

0 Answers0