Setting active object through python issues
I have seen this issue when using a panel in the properties window to alter the active object. It would be related to the context.

The easy fix is to place your panel in the 3dview. This is just a matter of changing the panel's bl_space_type to VIEW_3D and bl_region_type to UI

It is possible that you can override the context to get it working, this answer explains that and links to more information.