Mr_Bro
4 years agoFrequent Contributor
Error while using Runner.CallMethod()
Hi Team,
i am using Python as Project script a Language, and i am trying to use Runner.CallMethod to execute a definition which is in a different routine, but i am getting error as "Python runtime error.Could not convert variant of type (Dispatch) into type (OleStr)"
i have used the import statements as well,
Please find the my below snippet and request you to please help me to resolve it
#Unit1
def testSample():
Log.Message("Automation")
import Unit1
def Executor():
strUnitName = "Unit1"
Runner.CallMethod(eval(str(strUnitName)+".testSample"))
request you to please help me to resolve this Problem.
Thanks and Regards,
Sathish K
Thanks for your reply
And the below solutions resolved my problem:
exec("Unit1.testSample()") and eval("Unit1.testSample()")
Regards,
Sathish Kumar