clips.Reset()
user = True

def py_getvar(k):
    return clips.Symbol('TRUE') if globals().get(k) else clips.Symbol('FALSE')
clips.RegisterPythonFunction(py_getvar)
clips.BuildRule('user-rule',
    '(test (eq (python-call py_getvar user) TRUE))',
    '(assert (user-present))', 'the user rule')
clips.Run()
clips.PrintFacts()
Using Python Functions From the Clips Expert System