She called for Indyref2 before the election was called thinking there was no chance May would be so stupid as to have an election (the lesson here is to never overestimate May).
I suspect it was supposed to be a slow burn tactic where she forced May to continuously deny and undermine the credibility of the Scottish parliament. If she had agreed to it I think she would have had two years to persuade people of the dangers of leaving the single market while painting independence as a vote to remain in the single market but not necessarily the EU.
As it was she had to campaign in a really unfocused way since there wasn’t enough time to build support for the single market and was forced to campaign on the same personality politics that the May forced everyone into. With a party that has been in power for 10 years and a decent opposition campaigner in Ruth Davidson not to mention Corbyn actually giving Labour voters something to actually vote for that was always going to be a loser.
If May’s sole purpose in calling the election was to damage the SNP then she played a blinder so from that point of view she actually had a really good election 🙂