diff --git a/io_import_scene_mhx.py b/io_import_scene_mhx.py
index 8ba9e625f4529f8a2fd9f3cd049e4d9510212e19..147ee6ed44c9adbe35dc9604b8a115e7afd4d868 100644
--- a/io_import_scene_mhx.py
+++ b/io_import_scene_mhx.py
@@ -2520,6 +2520,7 @@ class RigifyBone:
 
 
 def rigifyMhx(context):
+    global theArmature
     from collections import OrderedDict
 
     print("Modifying MHX rig to Rigify")
@@ -2701,6 +2702,7 @@ def rigifyMhx(context):
     del rig
     gen.name = name
     bpy.ops.object.mode_set(mode='POSE')
+    theArmature = gen
     print("MHX rig %s successfully rigified" % name)