You are also able to load Jython scripts at any time. By default all scripts placed at $basedir/griffon-app/resources/jython will be loaded when the application boostraps itself. For example griffon-app/resources/jython/fib.py might look like this:

Code Block

def addNumbers(a, b):
return a + b

With that code in place, the addNumbers function may be executed as a method call on a dynamic property named py from a Griffon controller. See below:

The dynamic property will be named py by default. The name of the property may be set explicitly in griffon-app/conf/Config.groovy by assigning a value to the griffon.jython.dynamicPropertyName property.

Code Block

griffon.jython.dynamicPropertyName = 'jythonPropertyName'

For most applications, the default name of py should be fine. You can also alter in which artifacts the property gets injected, by default only controllers will have that property. See griffon-app/conf/Config.groovy and look for the following entry