IT is not fun losing elections and what I felt in the early hours of yesterday morning was just as unpleasant as it used to be in the 80s, the 90s and the early years of this century – that time before the SNP started to win most electoral contests, usually out the park.

Politicians spin like tops when explaining the people’s verdict on them – in by-elections particularly – but voters see through it. It is therefore best to be honest.

The SNP did badly in Rutherglen and Hamilton West and we need to learn from that experience.

Of course, no party can deny electoral gravity forever and there were big headwinds pushing the SNP back in this particular poll.

READ MORE: Humza Yousaf, 'Contextual factors' behind SNP by-election defeat

It was caused by the bizarre but dangerous behaviour of the sitting SNP MP who was removed by a recall petition – the first ever in Scotland.

It was held in the still looming shadow of a police investigation into SNP finances, and to add to the party’s problems, a few self-indulgent members have been creating unhelpful headlines for an already virulently hostile press which will now go into SNP-very-bad-but-now-completely-finished overdrive.

All these were factors in persuading previous SNP voters to stay at home despite the very good SNP candidate Katy Loudon and that is what too many did in a place that had returned a Labour MP as recently as the 2017 UK General Election.

That history also meant that any short-term expression of dissatisfaction or long-standing opposition to the SNP was going to benefit Labour – a fact not lost on droves of Tory voters, who now can find in Starmer’s party a comfortable and rather familiar electoral haven.

Having lived through even more spectacular by-election victories – for example the SNP win in Govan in 1988 – I can also wryly recall that they are often followed by the return of the seat to the defending party at the next General Election.

Yet all that being said, the really important issue is not what has happened, but what needs to happen. The SNP, as the catechism puts it, need to “read, mark and inwardly digest” the lessons from Rutherglen and those are, at the very least, lessons of leadership, electoral organisation, internal governance, external message, independence strategy and holding your political nerve.

READ MORE: Seven independence campaigners offer the SNP advice after by-election loss

On some of these there is already good news. Humza Yousaf told every leadership hustings back in March that he wanted not just to be First Minister, but also first activist and he has been as good as his word. He leads from the front and has shown how inspiring he can be and how determined no matter the circumstances.

He will now, I am sure, focus on how we get back to winning.

One of the first priorities should be to give our formidable electoral machine a thorough MOT. The electoral software is already being updated but we need both to re-learn some traditional campaigning techniques and introduce some new ones. Like painting the Forth Bridge used to be, this is a perpetual task but recent heavy weather has meant it needs a bit more attention.

Any machine, though, is only as good as the fuel that drives it, and the SNP membership needs re-energised after a dispiriting period. Members must be at the heart of a more transparent and accountable SNP, and to achieve that, cultural and constitutional change are required.

Fortunately, those issues are also in hand with the governance and transparency review, set up by the NEC in April, due to give its recommendations to the SNP’s Annual National Conference next weekend.

How we run our affairs is our business but there is no doubt that we need to find the courage to lay down firm new foundations for our future.

Our message also needs to get on the front foot. The SNP in government have had lots of successes but we don’t talk about them enough. Our primary narrative has to be about what we have achieved, what we could achieve in a devolved parliament and what we will then achieve with independence. We shouldn’t be ashamed of radical approaches – for example in land reform – but we also need to focus on our ability to help people in their everyday lives, particularly during the current cost of living crisis.

One of the key doorstep messages in Rutherglen was about the need for such reassurance – personal and political. That applies also to our independence strategy which has too often obsessed about process instead of promising a better future. Let’s decide once and for all on our preferred route and move on, working with others and learning from new thinking like the recent Common Weal paper which has some interesting ideas with significant potential.

Finally, we need to be clear about what we mustn’t do and the Tory conference in Manchester demonstrates beyond doubt that pandering to the extremes and galloping to the fringes is always a disastrous tactic.

The SNP win when they offer a positive message of hope and look outwards with an inclusive, generous face. Hard-line bombast and negativity turn off voters.

READ MORE: 'Uncertain' if Labour have 'sealed the deal' with electorate

The Tories are a busted flush and get far too much publicity given their level of electoral support here but Labour’s new message about division chimes in a time of fear and uncertainty at national and international level.

It has to be met with a reassuring narrative that inspires and energises and that can only come from a party that is itself inspired and energised.

The SNP have to be such a party, because they alone can secure the route to becoming a prosperous modern Scotland within the European family of nations, a country which encourages achievement, supports those in need, and looks confidently out to the world.

We have the talent to make that happen so when we meet in conference in Aberdeen next week, we must get on with it.

Scotland needs us to do so.