23
[Python] TypeError 'module' object is not callable in Python
'module' object is not callable
-> when module name and class name are confused, this error raised
For example,
I have DBCM class inside dbcm.py and import DBCM class like this,
import dbcm
# do something with dbcm
with dbcm(slef.db_name, sql):
.....
It will raise that typeerror.
How to solve it,
Be clear which one is module and which one is class
from dbcm import DBCM as db_cm
with db_cm(self.db_name, sql):
....
Modified by Keoni Garner - Thank you!:
from dbcm import DBCM
with DBCM(self.db_name, sql):
....
23