Jython Scripting

95 bytes added, 08:58, 12 February 2019
Self written Jython packages for ImageJ: Simpler reformulation
== Self written Jython packages for ImageJ ==
On the way to perfectly organize Jython code, [ packages] are the next step. In A Jython, folders package is a folder that contain a set of modules are made packages by adding the file scripts together with a <code></code>file. This file can be empty. An Below is a typical structure for the <code></code> folder structure can look like this:
The reason for the last import to fail is the empty <code></code>. We have to define which modules of the package are imported when using <code>import *</code>. This is done by setting the variable <code>__all__</code> at in the <code></code>. For <code>myPackage2</code> this line of code is needed:
<source lang='python'>
Besides setting this variable, the <code></code> file can contain normal Jython code that is executed on upon importof the package.
== Bundle packages in a JAR file ==