Ministers have even set out new "Serious Shortage Protocols" to allow pharmacists to dispense different strengths and formulas of medicines to cope.
It says that Scottish ministers are seeking to ensure that people will still get the medicines and medical supplies "as far as is possible" if the UK leaves without a deal.
Pharmaceutical companies have stockpiled medicines and across the UK the NHS has stockpiled other supplies like medical devices and clinical consumables.
"Arrangements are also being made to transport into the UK, including by air, items that cannot be stockpiled," the letter states.
"Members of the public, GPs, community pharmacies and hospitals should not stockpile," the letter states.
"Shortages may occur, but the NHS will manage the situation and if necessary provide suitable alternatives or other treatment while supply is restored to normal levels."
But if the lack of supplies intensifies, the medical chiefs reveal that individual “Serious Shortage Protocols” may be authorised.
This would allow pharmacists to "amend prescriptions to dispense a different strength, formulation or an alternative medicine."
"These protocols will be time limited," the letter states.
"However we are in a strong place in Scotland to ensure that these protocols can be underpinned with electronic support using the ePharmacy Programme, which includes electronic communications on any amendments between pharmacies and GP practices."