The rebuke from Aslef followed a ScotRail driver being praised for “calling out” someone involved in the prank at Livingston North Station.
The train operator described such actions as “probably the scariest thing any train driver will ever experience other than their train actually striking a person”.
It was highlighted by “Goggsy”, who tweeted last night: “Shoutout to the ballsy @ScotRail announcer on the train for calling out the ‘individual who pretended to jump in front of the train at Livingston North’.”
Other ScotRail drivers such incidents were all too familiar.
Douglas Ross tweeted: “Sadly, we as drivers see this almost on a daily basis on the North Clyde [line].
“Kids have no idea of the dangers.”
Gary Straiton tweeted: “Had a group of Neds on the platform at North Queensferry recently.
"One of the p***** thought it hilarious to do something similar.
"Seen it a few times in my 38 years, so it didn’t really bother me.
"What bothers me, though, is their attitude.”
An Aslef spokesperson said: "People taking their own lives in front of a train is a tragedy for the individual involved, and that person’s family and friends, and also for the driver of the train and the other rail staff who will be involved, as well as the passengers who may witness what has happened.
“People who think it funny to pretend to jump in front of a train are thoughtless, not funny, and completely and utterly stupid.
"The word ‘bampot’ springs to mind."
ScotRail replied to Goggsy’s tweet by endorsing the driver’s action.
It said: “I don't blame them, it's probably the scariest thing any train driver will ever experience other than their train actually striking a person.
"Anyone who does it as a joke is an idiot of the highest order.”
A ScotRail spokesperson added: “We have zero-tolerance of anti-social behaviour, especially when it could put lives at risk.
"It has no place on Scotland’s railway, and we will continue to work with British Transport Police to clamp down on unacceptable behaviour.”