← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #669055]: Function in python file not running from sikuli

 

Question #669055 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/669055

    Status: Open => Answered

RaiMan proposed the following answer:
I am not sure, what you are trying to achieve, but this works having
main.sikuli and sub.py in the same folder:

# main.sikuli
sys.path.append(getParentFolder())
import sub as lsyb
reload (lsyb)

class firstclass(object):
  def __init__(self):
    self.abc=lsyb #.nameofpythonfile("Path of file")
    
  def search(self, p):
    a=self.abc.func(p)

cls = firstclass()
cls.search(lsyb)

# sub.py
def func(p):
  print("Hello" + str(p))

--- I do not understand, what this should do:
self.abc=lsyb.nameofpythonfile("Path of file")

--- a method def only needs self as first parameter if defined in a
class

--- a class itself does nothing (just a dfinition) - to use it, it must
be instantiated

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.