the EU doesnt use the ambiguous the term "country", having member states. Scotland is part of a member state, the UK. if it leaves the UK, it leaves that state so is no longer a member of the EU. EU representatives has said as much, because they have a bunch of rules on membership, a queue of...
this is not a valid assumption. they will leave the EU, and they will have to apply to join. this will take several years to resolve, even if its amicable and various countries with itchy regions don't seek to make it difficult.