i'm not sure what mako.imports is, that sounds like part of the Pyramid integration, so you'd want to check that as far as setting the config like this.
>>> from mako.lookup import TemplateLookup
>>> l = TemplateLookup(imports=["import logging"])
>>> l.put_string("some template", "hello world")
>>> print l.get_template("some template").code
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 8
_modified_time = 1349649241.423057
_enable_loop = True
_template_filename = None
_template_uri = 'some template'
_source_encoding = 'ascii'
import logging
_exports = []
def render_body(context,**pageargs):
__M_caller = context.caller_stack._push_frame()
try:
__M_locals = __M_dict_builtin(pageargs=pageargs)
__M_writer = context.writer()
# SOURCE LINE 1
__M_writer(u'hello world')
return ''
finally:
context.caller_stack._pop_frame()