sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #10729
Re: [Question #194681]: Use String to call Function?
Question #194681 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/194681
CryoGenID posted a new comment:
Hello Raimund,
thanks a lot for your reply.
I have now streamlined the code a little bit so that it is easier to read:
---
import InitSystem
modulesToRun = ("Test1", "Test2")
popup("OK starting Tests in Modules")
for currentModule in modulesToRun:
popup("Working with module " + currentModule)
exec("import "+ currentModule)
exec(currentModule + ".runModule()")
print("Testing ended.")
---
This is the content of Test1 and Test2:
---
from sikuli import *
def runModule():
popup("Run Test2")
---
What I am now getting if I run the main file is:
---
[error] Fehlermeldung: Traceback (most recent call last):
File "c:\temp\windows\sikuli-tmp2249617525542428429.py", line 21, in
exec("Test1"+".runModule()")
File "", line 1, in
AttributeError: 'module' object has no attribute 'runModule'
---
Why doesn't it find the function?
Do have an idea for me?
Thanks a lot and best regards,
Christian
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.