My project layout looks like:
run.py
jobs/
job1.py
job2.py
job1.py
is pretty basic:
class job1():
def __init__(self):
print 'yo'
In run.py, I have:
name = 'job1'
classname = 'jobs.%s' % name
__import__(classname)
Which obviously does not work:
Traceback (most recent call last):
File "run.py", line 5, in <module>
__import__(classname)
ImportError: No module named jobs.job1
What is the best way to import the modules in this manner?