If you use Cheetah, please support the project and register by clicking here:


8.1 #import and #from directives

Syntax:

#import MODULE_OR_OBJECT [as NAME] [, ...]
#from MODULE import MODULE_OR_OBJECT [as NAME] [, ...]

The #import and #from directives are used to make external Python modules or objects available to placeholders. The syntax is identical to the import syntax in Python. Imported modules are visible globally to all methods in the generated Python class.

#import math
#import math as mathModule
#from math import sin, cos
#from math import sin as _sin
#import random, re
#from mx import DateTime         # ## Part of Egenix's mx package.

After the above imports, $math, $mathModule, $sin, $cos and $_sin, $random, $re and $DateTime may be used in $placeholders and expressions.

If you use Cheetah, please support the project and register by clicking here: