python importlib no module named

Viewed 14691

I am using flask and have the following structure

<root>
manage_server.py
cas <directory>
--- __init__.py
--- routes.py
--- models.py
--- templates <directory>
--- static <directory>
--- formmodules <directory>
------ __init__.py
------ BaseFormModule.py
------ Interview.py

In routes.py, I'm trying to create an instance of the Interview class in the Interview module, like so

my_module = "Interview"
module = importlib.import_module('formmodules."+my_module)

I get an error here that says

ImportError: No module named formmodules.Interview

Some info about the init files:

/cas/formmodules/__init__.py is empty
/cas/__init__.py is where I initialize my flask app. 

Let me know if it is helpful to know the contents of any of these files.

1 Answers
Related