Run the bit of wire that needs to flex parallel to the hinge: It’ll only twist a quarter turn at each door opening. Thin wire painted the same color as the door will be almost invisible. If you want it truly invisible, embed it in the door, make it exit right at the edge hinge-side, run it along the edge for a couple inches to let it twist freely, then into the jamb and into the wall. It’ll only be visible if you look for it, when the door is open.