The problem was in your ping.py
file. I don't know exactly why, but when dinamically importing it was not accepting the line from service import Service
, so you just have to change it to the relative path: from lib.services.service import Service
. Adding lib/services
to the sys.path
could not make it work the inheritance, which I found strange...
Also, I am using imp.load_source
which seems more robust:
import os, imp
def doimport( clazz, modPart, kw, class_check):
path = os.path.join('lib', modPart, clazz + '.py')
mod = imp.load_source( clazz, path )
item = mod.create(kw)
if class_check(item):
print "im happy"
return item