Routing internal hose for a hydraulic brake or a wire for an electric component is made a lot easier by using a guide wire. I like to use a bicycle brake cable. The most important part of this is to use the existing wire/hose to pull a guide wire or new hose through the frame (method 1 outlined in the 1st video link below). If you are replacing a brake hose you can attach the new one to the old one like the video shows and then feed it into the frame while guiding (dont pull hard) on the original one being removed.
https://www.youtube.com/watch?v=oAd7Jj6d094
If you are replacing a wiring harness its best to tape a brake cable to the end of the harness (the bottom by the motor) and then pull the wiring harness out the top of the frame which will pull the brake cable through the inside of the frame. Tape the bottom of the new harness to the brake cable and then feed it into the top of the frame while lightly pulling on the brake cable to guide the harness. You want to push the harness into the frame to move it, not pull by the brake cable otherwise it will become disconnected.