|
From: Ype K. <yk...@xs...> - 2002-09-17 18:38:19
|
Yang,
On Monday 16 September 2002 23:27, Yang Wang wrote:
> Hi All,
>
> I am looking for a best practise to organize Jython
> files.
You can organise your files in python packages.
A python package is a directory on the python path
that contains an (evt. empty) __init__.py file.
See the standard python docs on packages.
> I have some jython files that has several functions in
> it and dependent on other jython files. Since they
> will be tons of them, I want to put them into
> difference directory for clarity. Then I encounter
> the problem of execute these files. I tried to use
> relative path and it do not seem to work. Ony if I
> use the whole path, I can run them correctly. I like
> to use "execfile("filename")" for imports.
I'd advice to avoid execfile() as long as you can.
Once you have things a package you can do:
from yourPackage import yourPythonModule
or:
import yourPackage.
Have fun,
Ype
|