There has been much confusion as to why Grant Shapps and Boris Johnson have been commenting on the above accident. Scotland’s media have been less than clear about where responsibility for the inspection and accident prevention lies – London.

As far as I can see, rail accident prevention is a reserved matter and the Scottish Government has no effective role in this:

Transport safety and regulation, including “regulation of aviation and
shipping marine and air safety, rail safety and regulation (except for
appropriate oversight by the Scottish Executive of Scottish passenger rail
services), and some aspects of road traffic regulation”; transport
security; driver and vehicle licensing and testing; road haulage; vehicle
standards; general speed limits; marine, air and rail accident prevention
and investigation
; some other aspects of road safety and technical
standards relating to the transport of disabled people would be reserved
to the UK Parliament
. In the event, Schedule 5, Part II, Head E the Scotland Act 1998, as amended, prescribes those areas reserved to the UK Parliament; everything else is devolved.

House of Commons, BRIEFING PAPER Number SN03156, 12 June 2017
Transport in Scotland, Wales & Northern Ireland

That this is the legal position is clear when we hear HM Chief Inspector of Railways Ian Prosser, say: ‘ORR inspectors are on site at Stonehaven, assisting in the preliminary investigation. We will work with other agencies, including the emergency services, to find out exactly what happened and identify the causes of this tragic incident.’

In November 2019, the SNP manifesto called for change:

SNP: decarbonising the railways and building better infrastructure. The SNP manifesto pledges to make public transport “better and greener”. The manifesto stressed that the franchise-owned method of running the railways while the infrastructure sits with Network Rail “isn’t working.” Unlike the Labour manifesto which spoke of nationalising the railways, SNP said it will hand it over to the public sector. “We will insist our railways are run here in Scotland and that they can be run by the public sector. “We support the overdue and necessary change to full Scottish public sector control of the structure, governance and operation of the Scottish railway system,” it said.

https://www.railway-technology.com/features/election-2019-what-are-uk-politicians-pledging-for-the-rail-industry/