Using the import statement of Python to load a self build module sometimes fails. In my personal experience most of the time the problem was due to unresolved symbols in my .so modules. For QNX and many other POSIX compatible systems like GNU/Linux Python uses dlopen to load the dynamic libraries aka modules.
To have a deeper look at this issue it may help to start Python in more verbose mode using the option -v:
The printed messages are listing different attempts to load the required module with different names in different locations. Finally dlopen is called with the .so file named module.so. Afterwards the names of the unknown symbols are shown. An unknown symbol is a reference to a function or method that should be available at runtime but the loading mechanism can not find the required resource.
On QNX some more information about the loading process of dlopen are available. To enable these information use
from the shell or from Python
os.environ['DL_DEBUG'] = ’1′
to get a more verbose dlopen.
To have a look at the specific dynamic .so module it is possible to use the linker ld. Use the option -M or –print-map to print a link map. More options are available from the manual of ld, e.g. the one for GNU ld of the binutils package is available from http://sourceware.org/binutils/docs/ld/index.html.
To ensure that that a dynamic module has no undefined symbols the linker option –no-allow-shlib-undefined may be used. Depending on the build process it may be possible to add the following line to the Makefile: