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

RaiMan posted a new comment:
Uuups, I do not understand your "but this is getting complicated for a
too simple of an issue"

The issue is 2-fold:
1. importing skl
2. organizing modules and using the import feature of Python correctly and 
efficiently

2. has nothing to do with Sikuli or the fact, that .skl cannot be
imported currently.

1. is solved easily with the proposed solution: (comment #9)

Here a useable function, to make a .skl ready to be imported:

def loadSKL(name, dir = None):
    import org.sikuli.basics.FileManager as SFm
    import os
    if not dir:
        dir = os.path.join(os.path.dirname(os.path.dirname(getBundlePath())))
    sub = os.path.join(dir, name + ".skl")
    spath = os.path.dirname(SFm.unzipSKL(sub))
    if sPath:
        sys.path.append(spath)
        return true
    return false
    
*** usage for a mymodule.skl in same directory:

loadSKL("mymodule")
import mymodule

usage for a mymodule.skl in same directory:

loadSKL("mymodule", "some-absolute-path-to-folder-containing-the-skl")
import mymodule

as already mentioned
from my module import *
can be used as well

So besides the fact, that currently you have to implement your own
function, to make a .skl importable, there is no difference to the
situation, when Sikuli will allow other forms of packaging scripts,
images and other resources, since the usage will be:

load <script-container>
import some-module-from-container

So the valuation in comment #15 to some extent underestimates your
current possibilities and overestimates the role of Sikuli in this case.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to