I am using FME 2012 and would like to write a startup python script in which I can import a python module and call that module's function. I used to be able to do this with pyfme but with FME 2012 I have to use fmeobjects and it throws an error when I do. Two simple test cases below.
What might be causing the error? Looks like when I import the custom module, fmeobjects is not getting recognized.
Embedded script (works):
import fmeobjects
def audit_start():
logger = fmeobjects.FMELogFile()
logger.logMessageString("audit_start()")
for name,val in FME_MacroValues.iteritems():
logger.logMessageString( " %s:%s" %(name,val))
audit_start()
Imported script (error):
import audit
audit.audit_start()
audit.py
import fmeobjects
def audit_start():
logger = fmeobjects.FMELogFile()
logger.logMessageString("audit_start()")
for name,val in FME_MacroValues.iteritems():
logger.log( " %s:%s" %(name,val))
Error: Python Exception <NameError>: global name 'FME_MacroValues' is not defined