>>1419132Prussians already tried that with their Wittfeld type battery railcars (pic related - the only surviving one), and then the West German DB had their class 515 running for about 20 years but it never took off in mainline service to be honest. For the early 20th century local railways the battery power was certainly better than a classic heavy train, but once diesel engines became good enough, the battery-powered trains had to take a backseat.
The best application of battery power is for small depot or industrial switchers like the East German El16 ASF, common in the former Warsaw Pact countries. This thing is compact (perfect for turn and transfer tables) and laughably easy to operate and maintain, drove it myself several times.
https://www.bahnbilder.de/1024/die-asf-1-hatte-am-444397.jpg