I followed advice here on stackoverflow on how to import a class from a path outside of the root folder: How to dynamically load a Python class Does python have an equivalent to Java Class.forName()?
Unfortunately this raises the error: ValueError: Empty module name
It is my understanding that import should not return an empty module, like the load_source method from imp. So I do not understand this error nor how to approach it.
What am I implementing wrong here? Could you tilt me into the right direction here?
Thanks!
Code:
klass = __import__('..folder.module.Class_A')
some_object = klass()
class class_B(some_object):
def run(self):
print ('Test OK!')
Imported class (content of module):
class Class_A():
def __init__(self, arg1, *args):
def run(self):
pass