Set active object with python
Just a little update if you are searching for this for 2.80:

The active object has moved from the scene to the new view layers system, as you can have multiple active objects across multiple view layers. 

bpy.context.view_layer.objects.active = some_obj


I would link to the ba post, but offsite linking is hated upon here. 
So, thanks to you, iceythe!