Automated tests 来自导入的其他Sikuli脚本的函数不起作用

Automated tests 来自导入的其他Sikuli脚本的函数不起作用,automated-tests,sikuli,Automated Tests,Sikuli,这是sikuli脚本中名为switch_to_apps.sikuli的函数 我将此脚本导入另一个脚本(主脚本)并调用函数go_to_apps() 但艾德告诉我: [错误]名称错误(未定义名称“转到应用程序”) 如果我首先打开switch_to_apps.sikuli脚本并运行函数go_to_apps(),在该函数完成工作后,我运行主脚本,现在所有工作正常 我需要从导入的脚本执行该操作吗?如果您使用从切换到应用导入*,而不是导入切换到应用 或者可能切换到应用。转到应用(),而不是转到应用() 我在

这是sikuli脚本中名为switch_to_apps.sikuli的函数

我将此脚本导入另一个脚本(主脚本)并调用函数go_to_apps()

但艾德告诉我:

[错误]名称错误(未定义名称“转到应用程序”)

如果我首先打开switch_to_apps.sikuli脚本并运行函数go_to_apps(),在该函数完成工作后,我运行主脚本,现在所有工作正常


我需要从导入的脚本执行该操作吗?

如果您使用
从切换到应用导入*
,而不是
导入切换到应用

或者可能
切换到应用。转到应用()
,而不是
转到应用()


我在一个类中有我的定义,所以可能会有点不同,然后我认为会丢失定义

这是在课堂上进行的防御吗?不,不是在课堂上……完全正确<代码>从切换到应用导入*有效!谢谢
def go_to_apps():
    if exists(Pattern("1505400746884.png").similar(0.85)):
        click(Pattern("1505400746884.png").similar(0.85))
        wait(2)
        if exists("1505400452627.png"):

            wait("1505746343759.png",FOREVER)

            click("1505745789021.png")

        else:
            click(Pattern("1505401581163.png").similar(0.95))

    else:
        click(Pattern("1505400343997.png").similar(0.80))
        if exists("1505400452627.png"):
            wait("1505746343759.png",FOREVER)

            click("1505745789021.png")
        else:
            click(Pattern("1505401581163.png").similar(0.95))
type("r", Key.WIN)
wait(1)
type ("***************" + Key.ENTER)

wnd= App ("*********.exe")

while not wnd.isRunning():
    wait(1)


if exists(Pattern("1505813384072.png").similar(0.85)):
    pass
else:    
    popup("ERROR")


import switch_to_apps
go_to_apps()

wait (5)

rightClick(Pattern("1504795371766.png").similar(0.80))
wait(1)
click(Pattern("1504795615700.png").targetOffset(-75,80))