开发者

How i can use a function in sikuli which is defined in an another sikuliscript?

开发者 https://www.devze.com 2023-04-12 23:23 出处:网络
I try to use Sikuli. I will have 2 Files. One of them will be the \"main\" file and one of then is for functions.

I try to use Sikuli. I will have 2 Files. One of them will be the "main" file and one of then is for functions.

The main-file I have called "test" and the file for the Function I have called "importi".

If I run the main file, I will get the error:

[error] Fehlermeldung: Traceback (most recent call last): File "C:...\Temp\sikuli-tmp8331266965127754273.py",line 3, in importi.help()

AttributeError: 'module'object has no attribute 'hallo'

This is my Code of the main开发者_开发问答-file:

import importi
importi.hallo()

and this is the code of the File with the function:

anzeige = "Hallo"
def help():
  popup(anzeige)


I think in the calling function you should write -

import importi
importi.help()

in above code "help" is the function name defined in called (or imported) function. At the same time, below code should be saved as importi.sikuli file.

anzeige ="Hallo"
def help():
  popup(anzeige)

So, to summarize. File importi.sikuli has -

anzeige ="Hallo"
def help():
  popup(anzeige)

And calling function (whatever name it has) is -

import importi
importi.help()
0

精彩评论

暂无评论...
验证码 换一张
取 消