Hi there,
Swiss lenders generally require that you are a resident of Switzerland at the time that you apply for a loan.
It is possible to leave Switzerland in spite of having debts, as debt does not limit your freedom to emigrate. However, whether or not you can maintain a loan after emigrating will depend on the terms and conditions of your loan agreement.
In any case, it is crucial that you continue to meet your repayments on time. Failing to meet your debt repayment obligations can result in a debt collection case being opened by your creditor. Your creditor may be able to seize your assets in Switzerland (including salaries from Swiss employers or pensions from Swiss pension funds) to repay your debt, in keeping with laws governing debt collection.
Best regards from Moneyguru