今回はモジュールの作成方法と利用方法を確認します。
モジュールとして別ファイルを作成し、本体からはimportで作成したモジュールを読み込んで使えるようにするという感じです。

・スクリプト 
class testclass:
def __init__(self):
print ("create testclass")

def test_method(self,str):
print ("call test method")
print (str)

→上記モジュールをtestmodule.pyというファイル名で本体のスクリプトと同じフォルダに配置します。 

import testmodule
testclass1 = testmodule.testclass()
testclass1.test_method("1")

from testmodule import testclass
testclass1 = testclass()
testclass1.test_method("2") 

→まず、「import testmodule」でモジュールを読み込みます。
その後、モジュール名.クラス名でtestclassの初期化を行ないます。
初期化時にモジュールの「def __init__(self):」内の処理が読み込まれます。
初期化後に、testclass内の関数test_methodを読み込みます。

また、import時に「from モジュール名 import クラス名」と指定することで、 初期化時にモジュール名を記載する必要が無くなります。

・実行結果
create testclass
call test method
1
create testclass
call test method
2