Simple 'add object' addon problem - new object is not selected? [SOLVED]

I have a simple addon that adds a new object to the primitives menu, but when I create the object this way, it doesn’t get selected, I have to select it manually. How to make it automatically selected after being created?

bl_info = {
"name": "Ring", 
"author": "Gert De Roost",
"version": (1, 0, 0),
"blender": (2, 65, 0),
"location": "Add > Mesh",
"description": "Create Ring primitive.",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Add Mesh"}


if "bpy" in locals():
	   import imp


import bpy
import bmesh
import math
from mathutils import *


class Ring(bpy.types.Operator):
	bl_idname = "mesh.ring"
	bl_label = "Ring"
	bl_options = {'REGISTER', 'UNDO'}
	bl_description = "add Ring primitive"

	def invoke(self, context, event):

		mesh = bpy.data.meshes.new(name="Ring")
		obj = bpy.data.objects.new(name="Ring", object_data=mesh)
		scene = bpy.context.scene
		scene.objects.link(obj)
		obj.location = scene.cursor_location
		bm = bmesh.new()
		bm.from_mesh(mesh)

		idxlist = []
		vertlist = [(-0.04267767071723938, 0.01767767034471035, 0.017749521881341934), (0.01767767034471035, 0.04267767071723938, 0.017749521881341934), (0.04267767071723938, -0.01767767034471035, 0.017749521881341934), (-0.01767767034471035, -0.04267767071723938, 0.017749521881341934), (0.01767767034471035, -0.04267767071723938, -0.017749521881341934), (-0.01767767034471035, -0.04267767071723938, -0.017749521881341934), (0.01767767034471035, -0.04267767071723938, 0.017749521881341934), (0.04267767071723938, -0.01767767034471035, -0.017749521881341934), (0.04267767071723938, 0.01767767034471035, -0.017749521881341934), (0.04267767071723938, 0.01767767034471035, 0.017749521881341934), (0.01767767034471035, 0.04267767071723938, -0.017749521881341934), (-0.01767767034471035, 0.04267767071723938, -0.017749521881341934), (-0.01767767034471035, 0.04267767071723938, 0.017749521881341934), (-0.04267767071723938, 0.01767767034471035, -0.017749521881341934), (-0.04267767071723938, -0.01767767034471035, -0.017749521881341934), (-0.04267767071723938, -0.01767767034471035, 0.017749521881341934), (-0.04267767071723938, -0.01767767034471035, -0.03549904376268387), (-0.03276650607585907, -0.03276650607585907, 0.017749521881341934), (-0.04267767071723938, 0.01767767034471035, 0.03549904376268387), (-0.03276650607585907, 0.03276650607585907, -0.017749521881341934), (-0.01767767034471035, 0.04267767071723938, -0.03549904376268387), (0.01767767034471035, 0.04267767071723938, 0.03549904376268387), (0.03276650607585907, 0.03276650607585907, -0.017749521881341934), (0.04267767071723938, 0.01767767034471035, -0.03549904376268387), (0.04267767071723938, -0.01767767034471035, 0.03549904376268387), (0.03276650607585907, -0.03276650607585907, -0.017749521881341934), (0.01767767034471035, -0.04267767071723938, -0.03549904376268387), (-0.01767767034471035, -0.04267767071723938, 0.03549904376268387), (-0.04267767071723938, 0.01767767034471035, -0.03549904376268387), (-0.03276650607585907, -0.03276650607585907, -0.017749521881341934), (-0.04267767071723938, -0.01767767034471035, 0.03549904376268387), (-0.03276650607585907, 0.03276650607585907, 0.017749521881341934), (0.01767767034471035, 0.04267767071723938, -0.03549904376268387), (-0.01767767034471035, 0.04267767071723938, 0.03549904376268387), (0.03276650607585907, 0.03276650607585907, 0.017749521881341934), (0.04267767071723938, -0.01767767034471035, -0.03549904376268387), (0.04267767071723938, 0.01767767034471035, 0.03549904376268387), (0.03276650607585907, -0.03276650607585907, 0.017749521881341934), (-0.01767767034471035, -0.04267767071723938, -0.03549904376268387), (0.01767767034471035, -0.04267767071723938, 0.03549904376268387), (-0.01767767034471035, -0.04267767071723938, 0.0), (0.01767767034471035, -0.04267767071723938, 0.0), (0.0, -0.04633883386850357, -0.017749521881341934), (0.0, -0.04633883386850357, 0.017749521881341934), (0.04267767071723938, -0.01767767034471035, 0.0), (0.04267767071723938, 0.01767767034471035, 0.0), (0.04633883386850357, 0.0, -0.017749521881341934), (0.04633883386850357, 0.0, 0.017749521881341934), (0.01767767034471035, 0.04267767071723938, 0.0), (-0.01767767034471035, 0.04267767071723938, 0.0), (0.0, 0.04633883386850357, -0.017749521881341934), (0.0, 0.04633883386850357, 0.017749521881341934), (-0.04267767071723938, 0.01767767034471035, 0.0), (-0.04267767071723938, -0.01767767034471035, 0.0), (-0.04633883386850357, 0.0, -0.017749521881341934), (-0.04633883386850357, 0.0, 0.017749521881341934), (-0.03276650607585907, -0.03276650607585907, -0.03549904376268387), (-0.03276650607585907, -0.03276650607585907, 0.03549904376268387), (-0.03276650607585907, 0.03276650607585907, -0.03549904376268387), (-0.03276650607585907, 0.03276650607585907, 0.03549904376268387), (0.03276650607585907, -0.03276650607585907, -0.03549904376268387), (0.03276650607585907, -0.03276650607585907, 0.03549904376268387), (0.03276650607585907, 0.03276650607585907, -0.03549904376268387), (0.03276650607585907, 0.03276650607585907, 0.03549904376268387), (-0.04633883759379387, 0.0, -0.03549904376268387), (-0.03276650607585907, -0.03276650607585907, 7.882370816629291e-17), (-0.04633883759379387, 0.0, 0.03549904376268387), (-0.03276650607585907, 0.03276650607585907, -7.882370816629291e-17), (0.0, 0.04633883759379387, -0.03549904376268387), (-6.203854594147708e-25, 0.04633883759379387, 0.03549904376268387), (0.03276650607585907, 0.03276650607585907, -7.882370816629291e-17), (0.04633883759379387, 0.0, -0.03549904376268387), (0.04633883759379387, 0.0, 0.03549904376268387), (0.03276650607585907, -0.03276650607585907, 7.882370816629291e-17), (6.203854594147708e-25, -0.04633883759379387, -0.03549904376268387), (0.0, -0.04633883759379387, 0.03549904376268387), (5.169878828456423e-26, -0.04633883386850357, 0.0), (0.04633883386850357, 0.0, -3.9100314471867215e-27), (-5.169878828456423e-26, 0.04633883386850357, 0.0), (-0.04633883386850357, 0.0, 3.9100314471867215e-27)]
		for co in vertlist:
			v = bm.verts.new(co)
			bm.verts.index_update()
			idxlist.append(v.index)
		edgelist = [[0, 55], [0, 18], [0, 31], [0, 52], [1, 51], [1, 21], [1, 34], [1, 48], [2, 47], [2, 24], [2, 37], [2, 44], [3, 43], [3, 27], [3, 17], [3, 40], [4, 25], [4, 41], [4, 42], [4, 26], [5, 42], [5, 40], [5, 29], [5, 38], [6, 37], [6, 39], [6, 43], [6, 41], [7, 46], [7, 44], [7, 25], [7, 35], [8, 22], [8, 45], [8, 46], [8, 23], [9, 34], [9, 36], [9, 47], [9, 45], [10, 50], [10, 48], [10, 22], [10, 32], [11, 19], [11, 49], [11, 50], [11, 20], [12, 31], [12, 33], [12, 51], [12, 49], [13, 54], [13, 52], [13, 19], [13, 28], [14, 29], [14, 53], [14, 54], [14, 16], [15, 17], [15, 30], [15, 55], [15, 53], [64, 16], [16, 56], [65, 17], [17, 57], [66, 18], [18, 59], [67, 19], [19, 58], [68, 20], [20, 58], [69, 21], [21, 63], [70, 22], [22, 62], [71, 23], [23, 62], [72, 24], [24, 61], [73, 25], [25, 60], [74, 26], [26, 60], [75, 27], [27, 57], [58, 28], [28, 64], [56, 29], [29, 65], [57, 30], [30, 66], [59, 31], [31, 67], [62, 32], [32, 68], [59, 33], [33, 69], [63, 34], [34, 70], [60, 35], [35, 71], [63, 36], [36, 72], [61, 37], [37, 73], [56, 38], [38, 74], [61, 39], [39, 75], [76, 40], [40, 65], [73, 41], [41, 76], [76, 42], [42, 74], [75, 43], [43, 76], [77, 44], [44, 73], [70, 45], [45, 77], [77, 46], [46, 71], [72, 47], [47, 77], [78, 48], [48, 70], [67, 49], [49, 78], [78, 50], [50, 68], [69, 51], [51, 78], [79, 52], [52, 67], [65, 53], [53, 79], [79, 54], [54, 64], [66, 55], [55, 79]]
		for verts in edgelist:
			try:
				bm.edges.new((bm.verts[verts[0]], bm.verts[verts[1]]))
			except:
				pass
		facelist = [(0, 52, 79, 55), (0, 55, 66, 18), (0, 18, 59, 31), (0, 31, 67, 52), (1, 48, 78, 51), (1, 51, 69, 21), (1, 21, 63, 34), (1, 34, 70, 48), (2, 44, 77, 47), (2, 47, 72, 24), (2, 24, 61, 37), (2, 37, 73, 44), (3, 40, 76, 43), (3, 43, 75, 27), (3, 27, 57, 17), (3, 17, 65, 40), (4, 26, 60, 25), (4, 25, 73, 41), (4, 41, 76, 42), (4, 42, 74, 26), (5, 38, 74, 42), (5, 42, 76, 40), (5, 40, 65, 29), (5, 29, 56, 38), (6, 41, 73, 37), (6, 37, 61, 39), (6, 39, 75, 43), (6, 43, 76, 41), (7, 35, 71, 46), (7, 46, 77, 44), (7, 44, 73, 25), (7, 25, 60, 35), (8, 23, 62, 22), (8, 22, 70, 45), (8, 45, 77, 46), (8, 46, 71, 23), (9, 45, 70, 34), (9, 34, 63, 36), (9, 36, 72, 47), (9, 47, 77, 45), (10, 32, 68, 50), (10, 50, 78, 48), (10, 48, 70, 22), (10, 22, 62, 32), (11, 20, 58, 19), (11, 19, 67, 49), (11, 49, 78, 50), (11, 50, 68, 20), (12, 49, 67, 31), (12, 31, 59, 33), (12, 33, 69, 51), (12, 51, 78, 49), (13, 28, 64, 54), (13, 54, 79, 52), (13, 52, 67, 19), (13, 19, 58, 28), (14, 16, 56, 29), (14, 29, 65, 53), (14, 53, 79, 54), (14, 54, 64, 16), (15, 53, 65, 17), (15, 17, 57, 30), (15, 30, 66, 55), (15, 55, 79, 53)]
		bm.verts.ensure_lookup_table()
		for verts in facelist:
			vlist = []
			for idx in verts:
				vlist.append(bm.verts[idxlist[idx]])
			try:
				bm.faces.new(vlist)
			except:
				pass

		bm.to_mesh(mesh)
		mesh.update()
		bm.free()
		obj.rotation_quaternion = (Matrix.Rotation(math.radians(90), 3, 'X').to_quaternion())

		return {'FINISHED'}


def menu_item(self, context):
	   self.layout.operator(Ring.bl_idname, text="Ring", icon="PLUGIN")

def register():
	   bpy.utils.register_module(__name__)
	   bpy.types.INFO_MT_mesh_add.append(menu_item)

def unregister():
	   bpy.utils.unregister_module(__name__)
	   bpy.types.INFO_MT_mesh_add.remove(menu_item)

if __name__ == "__main__":
	   register()

for versions before 2.80 this could work:

bpy.ops.object.select_all(action='DESELECT')
obj.select = True
bpy.context.scene.objects.active = obj

relevant Python API:
https://docs.blender.org/api/blender_python_api_2_65_8/info_overview.html

Thank you, it worked.