backends: use template_utils
diff --git a/c_gen/util.py b/c_gen/util.py
index d4b25bf..54e0f80 100644
--- a/c_gen/util.py
+++ b/c_gen/util.py
@@ -30,12 +30,13 @@
 """
 import os
 import loxi_utils.loxi_utils as utils
+import template_utils as template_utils
 
 templates_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'templates')
 template_path = [templates_dir, templates_dir + '/locitest']
 
 def render_template(out, name, **context):
-    utils.render_template(out, name, template_path, context)
+    template_utils.render_template(out, name, template_path, context)
 
 def render_static(out, name):
-    utils.render_static(out, name, template_path)
+    template_utils.render_static(out, name, template_path)
diff --git a/java_gen/codegen.py b/java_gen/codegen.py
index 1ba0b8f..0b3ed35 100644
--- a/java_gen/codegen.py
+++ b/java_gen/codegen.py
@@ -41,6 +41,7 @@
 from collections import namedtuple
 from import_cleaner import ImportCleaner
 
+import template_utils
 import loxi_utils.loxi_utils as loxi_utils
 
 import java_gen.java_model as java_model
@@ -86,7 +87,7 @@
         prefix = '//::(?=[ \t]|$)'
         print "filename: %s" % filename
         with open(filename, "w") as f:
-            loxi_utils.render_template(f, template, [self.templates_dir], context, prefix=prefix)
+            template_utils.render_template(f, template, [self.templates_dir], context, prefix=prefix)
 
         try:
             cleaner = ImportCleaner(filename)
diff --git a/lang_python.py b/lang_python.py
index 9c9d13e..e3e6e60 100644
--- a/lang_python.py
+++ b/lang_python.py
@@ -66,6 +66,7 @@
 import py_gen
 import py_gen.util
 import py_gen.codegen
+import template_utils
 
 versions = {
     1: "of10",
@@ -102,8 +103,8 @@
         filename = '%s/%s/%s.py' % (prefix, subdir, module)
         targets[filename] = make_gen(module, version)
 
-def generate():
+def generate(install_dir):
     py_gen.codegen.init()
     for (name, fn) in targets.items():
-        with loxi_utils.open_output(name) as outfile:
+        with template_utils.open_output(install_dir, name) as outfile:
             fn(outfile, os.path.basename(name))
diff --git a/py_gen/codegen.py b/py_gen/codegen.py
index 70053f7..3c98333 100644
--- a/py_gen/codegen.py
+++ b/py_gen/codegen.py
@@ -29,6 +29,7 @@
 import struct
 import of_g
 import loxi_front_end.type_maps as type_maps
+import template_utils
 import loxi_utils.loxi_utils as utils
 import util
 import oftype
diff --git a/py_gen/util.py b/py_gen/util.py
index f527964..3913b9c 100644
--- a/py_gen/util.py
+++ b/py_gen/util.py
@@ -31,15 +31,16 @@
 
 import os
 import of_g
+import template_utils
 import loxi_utils.loxi_utils as utils
 
 templates_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'templates')
 
 def render_template(out, name, **context):
-    utils.render_template(out, name, [templates_dir], context)
+    template_utils.render_template(out, name, [templates_dir], context)
 
 def render_static(out, name):
-    utils.render_static(out, name, [templates_dir])
+    template_utils.render_static(out, name, [templates_dir])
 
 def constant_for_value(version, group, value):
     enums = of_g.ir[version].enums