Hiding objects with scripting - unpredictable behaviour
I think the problem here is that you do not set the active object for the context on which operators almost always rely. Here is a low-level approach without operators, tested and working. All children (recursive) of the active object are hidden.

import bpy

ob = bpy.context.active_object

def makeInvisible(ob):
    for child in ob.children:
        child.hide = True
        #call the function on the child to catch all its children
        #as there is no ob.children_recursive attribute
        makeInvisible(child)

makeInvisible(ob)


Note that this does not hide the active object itself, only its children. If you want to hide the active object too, just add ob.hide = True right below the function header.