天天看点

python错误:TypeError: 'module' object is not callable

在Python中 调用其他函数或类时:TypeError: 'module' object is not callable,与import导入机制有关

详细观察import导入的方式:明确一点的是,attention_keras.py文件和attention_tf.py文件在同一个包里(即一个文件夹下)

python错误:TypeError: 'module' object is not callable

在调用attention_tf.py文件中的函数时,发现attention_tf 不能调用

#设置attension-master-》Mark Directory As -> Resources ROOT

python错误:TypeError: 'module' object is not callable
python错误:TypeError: 'module' object is not callable

规则:1,如果调用的是B.py文件中的方法,即B.py 中有Class B: 调用的原则是:模块名—类名—方法名

           2, 如果调用的是B.py文件中的函数:模块名—函数名