The BTP East Scot official twitter account said the youngsters were discovered on the line in the Addiewell area on Friday.
The tweet, published on Saturday, said: “Yesterday afternoon two children, both five years old, were found playing on the railway tracks in the #Addiewell area.
“Trespassing on the railway is extremely dangerous and the consequences could be fatal.
Tom Jones Edinburgh: Princes Street Gardens concert stage times, support, setlist and how to get there
West Lothian crime: 'Horrendous' child rapist labelled 'utterly appalling' by judge
Edinburgh Airport: Taxi firms set to bid for control of rank as tender released
West Lothian crime news: A survivor of abuser Malcolm Andrew McDougal has spoken out about her experiences as he is found guilty in court
Irvine Welsh: Trainspotting author marries former Taggart star Emma Currie
“Do you know where your kids are playing this summer?”
The incidents included two groups of youths and a family walking a dog across a railway line between Longannet and Dunfermline.
In December, Network Rail was fined £135,000 after admitting health and safety breaches that led to a 13-year-old boy suffering serious injuries.
The teenager was hurt after he had gained access to a railway track and climbed onto the roof of a stationary train near Musselburgh, East Lothian.
The boy and two friends had managed to reach the track after climbing over fencing that was subsequently found to be "of an inappropriate type, of insufficient height and poorly maintained".
Following the incident an investigation was launched by rail regulator Office of Rail and Road (ORR) which found the fencing to be faulty and members of the public able to access the track with "relative ease".
BTP Inspectors Bryan O’Neill said previously that the railway is full of hidden dangers and that “too many times” they have seen the tragic consequences of young people ignoring warnings about trespassing on the wailway and taking risks which have resulted in serious injury or death.
Dangers include not only fast moving trains but electricity on the tracks and overhead lines.
A message from the Editor:
Thank you for reading this article. We're more reliant on your support than ever as the shift in consumer habits brought about by coronavirus impacts our advertisers.
If you haven't already, please consider supporting our trusted, fact-checked journalism by taking out a digital subscription at https://www.edinburghnews.scotsman.com/subscriptions.