Import Class - 'module' object is not callable

這算是初學者問題。範例專案結構如下:

example/
	__init_.py
	Test.py
main.py
Test.py中有一個class叫Test,而main.py我這樣使用它:
from example import Test
 
test = Test()
在執行時,會出現TypeError: 'module' object is not callable。

在這樣的專案結構下,common資料夾為package名稱,Test.py的Test為模組名稱,其內的class Test就是我要的類別名稱。因此正確的匯入應該是:

from common.Test import Test
假如Test.py中有其它類別叫Test2,則要使用以下方式匯入:
from common.Test import Test2