How change object attributes in game
You need to change these two lines, because the bpy module does not wok in the game engine.

hb = bpy.data.objects["HealthBar"]
should be changed to the code block below.

hud = None

for scene in bge.logic.getSceneList():
    if scene.name == "HUD":
        hud = scene
        break
hb = hud.objects["HealthBar"]


That loops through all the scenes in the game, and assigning a var of hud to the scene named HUD. Then the last line gets the object named HealthBar in the HUD scene.

Or simply this line if the object was in the same scene.
hb = bge.logic.getCurrentScene().objects["HealthBar"]



Your hb.dimensions[1] = health/100 line
must be changed to hb.worldScale[1] = health/100 (because there is no dimensions attribute in the game engine).