O'Reilly logo

WebSphere Application Server Administration Using Jython by Noel J. Bergman, Arthur Kevin McGrath, Robert A. Gibson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Jython Modules

Classes, functions, and variable definitions can be collected into files for easy reuse and maintenance. A file containing these kinds of definitions is referred to as a module and has a suffix of .py. In this chapter, we take a closer look at Jython modules.

Jython Module Basics

As with functions and classes, when Jython processes a module file, new global and local namespaces are defined to identify the objects that are directly accessible within the file. For example, given a simple module, as shown in Listing 5.1, how are the objects in this file used by other scripts?

Listing 5.1 Simple Module File (countdown.py)

The import Statement

The import statement is used to access the objects defined within a module ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required