You won't be able to switch from any degree into medicine (only some universities let the top 2% of biomed student switch to the medicine course but I've seen 2 do that). Even if you wanted to do postgrad med after your engineering degree, there's not a lot of universities that consider engineering degree close enough to a medical science degree (such as pharmacy, biomed, biology, neuroscience etc.) Furthermore, statistically for undergrad medicine the applicant to offer ratio is about 1 in 8, for post grad this can instantly rise to 1 in 40. So it's way harder to get in afterwards but I guess people still do it.
Foundation years is usually for those who are eligable for it, you need to live in a deprived/low income post code, go to a comprehensive school etc. Otherwise everyone would apply for the foundation year courses. You're going to have to look outside of Scotland, especially because there's only around 33 medical schools across the UK, and the only ones you can apply to are ones that do not require biology.
I would really weigh up your choices, why do you want to do medicine over engineering? You need to be realistic, medicine is demanding and the pay is quite ****, and you're still in training after you do 5-6 years in uni (you do 2 years of foundation training and then further 5-7 years of specialised training). The only way you can gain a realistic view is by doing work experience in a hospital, and a lot of it. If you can't stand 4 weeks, how can you stand it for the rest of your life? It's very important.
Also check if they want chemistry as an Advanced higher and not just a higher. This is vital because that's the only medicine required subject you have.
What I would suggest is try hard to get into engineering and secure your offers, you can always reject them later if you do decide you definitely want to medicine. If you do decide to, you'll have to reject your offers and take a gap year. It's very important you spend the summer revising for the UKCAT, this will require a lot of time out of your summer, typically 4 weeks of preparation, because you need your results for September 2018 to apply again for medicine. Aim for at least the 7th or 8th decile, but usually 700+ is considered quite comfortable to get in. During the time you immediately know you want to take a gap year and September, you really need to build up a portfolio of work experience (in hospitals/GPs), volunteering (many universities look for things like volunteering at an elderly people's home, hospice- in short notice you can probably get away with only doing 2-3 months of it). You'll need it by September in order to write your personal statement.
It sounds lengthy, but medicine is. It's not until you apply that you realise how easy other degrees are to get into, no work experience required, no lengthy volunteering, no interviews, no admissions tests (I mean some degrees have some of these but not of them together, as well as having an A grade minimum at some of the hardest A level subjects) I am trying to be honest though, at the end of the day, this isn't a light decision, this is your life. Good luck x