title: AttributeError: 'module' object has no attribute when trying to import c code into python
body: <p>I have an import to import a shared object library created in c. It looks like this:</p>
  
  <pre><code>import Cal
  </code></pre>
  
  <p>I then try to make a call in python with the shared object library like so:</p>
  
  <pre><code>status = Cal.Cal_readFile(filename, result)
  </code></pre>
  
  <p>However when I hit this code when running my python file I get the following error:</p>
  
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "/usr/lib/python3.4/tkinter/__init__.py", line 1541, in __call__
      return self.func(*args)
    File "xcal.py", line 72, in openDialog
      status = Cal.Cal_readFile(filename, result)
  AttributeError: 'module' object has no attribute 'Cal_readFile'
  </code></pre>
  
  <p>My makefile regarding the shared object library looks like this:</p>
  
  <pre><code>CC = gcc
  CFLAGS = -Wall -std=c11 -g -DNDEBUG `pkg-config --cflags python3`
  CFLAGS += -fPIC
  LDFLAGS=`pkg-config --libs python3`
  
  all: caltool Cal.so
  
  Cal.so: calmodule.o calutil.o
      $(CC) -shared $(LDFLAGS) $^ -o $@
  
  calutil.o: calutil.c calutil.h
  
  calmodule.o: calmodule.c calutil.c
  </code></pre>
  
  <p>And my C code looks like the following:</p>
  
  <pre><code>#include &lt;python3.4/Python.h&gt;
  #include "calutil.h"
  
  PyObject *Cal_readFile( PyObject *self, PyObject *args );
  
  static PyMethodDef CalMethods[] = {
    {"readFile", Cal_readFile, METH_VARARGS},
    {NULL, NULL} 
  };
  
  static struct PyModuleDef calModuleDef = {
    PyModuleDef_HEAD_INIT,
    "Cal", //enable "import Cal"
    NULL, //omit module documentation
    -1, //don't reinitialize the module
    CalMethods //link module name "Cal" to methods table 
  };
  PyMODINIT_FUNC PyInit_Cal(void) { 
    return PyModule_Create( &amp;calModuleDef ); 
  }
  
  PyObject *Cal_writeFile( PyObject *self, PyObject *args ) {
    return NULL;
  }
  </code></pre>
  
  <p><em>Note: The Cal_writeFile function does actually have stuff happening in it, just I didn't want to paste the big function as it likely isn't needed to solve this.</em></p>
  
  <p>Is there something I am doing wrong here? I feel like that Python <code>import Cal</code> should be properly be importing the shared object library named <code>Cal.so</code> that is in the same directory as the Python file.</p>