You can keep your residence permit for studies in Sweden even if you will be spending time in another country during part of the permit period, as long as the stay abroad is part of the education to which you have been admitted in Sweden. If you will be travelling to another country as part of your education, you should contact that country’s authorities to find out what is required to stay in that country.