I am trying to create a new module and method as part of the existing library.
The existing library is called Bly.Pht. I am creating a new * .i file in this directory which is named in Distance.py Distance.py I have:
square distance: def __init __ (self, handle): self.handle = def def_func (t1, t2): print "executed correctly" from the dragon shell, I do the following: Bly.Pht imports distance from
# This works fine dist = distance.test_func (input1, input2)
error me Makes
in the 'module' object, in particular Do not have 'test_func'
Is it possible to give any advice about this?
Many thanks.
You are not importing
distance class, you are importing modules It consists of the
distance class which can be fixed:
dist = distance.Distance.test_fund (input1, input2)
If you do not plan to include other functionality
Distance.py , the class definition may be
Bly / Pht / __ init __. There is a better idea to put in Py or
Bly / Pht.py , in which case you could import it as you did it. (Unlike other languages, Python does not encourage each category of its own file).
No comments:
Post a Comment