title: Import Cython class in Python file Pycharm
body: <p>How does one import a compiled cython file in a pycharm python file?</p>
  
  <p>Here is my setup.  </p>
  
  <p>From my project root directory, the cython class is "/classes/knn.cpython-35m-x86_64-linux-gnu.so."  My python file is "/classes/testing_cython_knn.py." </p>
  
  <p>I have an "__init __.py" file in "/classes/"... </p>
  
  <hr>
  
  <p>However, Pycharm does not recognize the ".so" file as a file which I can import.  What do I need to do in order to make this file available to import, so I can test it?</p>
  
  <hr>
  
  <p>Currently, I have successfully compiled and imported a "helloworld.so" file in regular, terminal-based python...however, the function I defined was a pythonic function...no C-stuff. </p>
  
  <p>My Cythonic file is:</p>
  
  <pre><code>import numpy as np
  cimport numpy as np
  
  
  from scipy.stats import mode
  from scipy.spatial.distance import cdist
  from threading import Thread
  
  
  
  cdef class KNN:
      cdef public int k
      cdef public str metric
      cdef public np.ndarray trainingX
      cdef public np.ndarray trainingY
      cdef public np.ndarray predict(self,np.ndarray X):
          cdef np.ndarray distances,predicted_classes,sorted_distance_indices
  
          distances = cdist(X,self.trainingX,metric=self.metric)
          predicted_classes = np.zeros(X.shape[0],dtype=np.float64)
          sorted_distance_indices = np.argpartition(distances,self.k,axis=1)[:,:self.k]
          predicted_classes,_ = mode(self.trainingY[sorted_distance_indices])
          return predicted_classes
  </code></pre>
  
  <p>And setup.py:</p>
  
  <pre><code>from distutils.core import setup
  from distutils.extension import Extension
  from Cython.Build import cythonize
  import numpy
  
  
  extensions = [
      Extension("knn",["cKNN.pyx"]),
      Extension("*",["*.pyx"],include_dirs=[numpy.get_include()])]
  
  setup(ext_modules = cythonize(extensions),include_dirs=[numpy.get_include()])
  </code></pre>
  
  <p>Currently, this fails on import to python running on the terminal with an Import Error: </p>
  
  <blockquote>
    <p>Dynamic module does not define module export function (PyInit_knn)</p>
  </blockquote>