how affect all children or parent of object?
I'm not sure if I understand you correctly, but you do not need separate code for each object that has the same behavior. You can use the same sensor/controller configuration at each of the objects.

When the enemies are all copies of the same object(s) you can assign them a group and add group instances to the scene.

This way you just configure the original in Blender and all instances receive the changes. This even works with add object when running the game.