mod = importlib.import_module(str)
fromSample2.py
とモジュールを使用してモジュールを呼び出そうとしています
functionPlayAround_Play.py
のみが含まれている場合、正常に動作しています。その関数にクラスを含めた場合
うまくいきません。エラーを取得するTypeError: this constructor takes no arguments
sample2.py のコード
import importlib
def calling():
str="PlayAround_Play"
a=10
b=20
c=30
mod = importlib.import_module(str)
getattr(mod,str)(a, b, c)
calling()
PlayAround_Play.py のコード
class PlayAround_Play():
def PlayAround_Play(self, a, b, c):
d=a+b+c
print d
を使用してそのクラスを呼び出す方法を教えてくださいimportlib