Scotland would still have to declare independence and prove its finances are in order before applying to accession to the EU.The Scottish economy is probably the biggest reason for staying. They receive significant equalisation funds from England. However, once Brexit really sets in, there is an argument that EU membership would be more economically beneficial than the Barnett formula under dwindling british tax receipts.
Membership may be fast tracked for Scotland (not impossible,) but it would still take time and would only be accepted if all the other member states agreed to it. As a punitive measure to the UK they may but with everything else with Brexit - everything is speculation.