俺のネタ帳
[トラブル] 自作クラスのimport時にTypeError: 'module' object is not callableになる
自作クラスのimport時に
TypeError: 'module' object is not callable
のエラーが出てしまう場合の原因と対処方法を紹介。
原因はimportの書き方が間違っているから
以下の書き方だとエラーになる。
import myClass
myInstance = myClass()
下の書き方に修正すると動く。
from (myClassのファイル名)
import myClass
myInstance = myClass()
次の投稿
前の投稿
ホーム