You cannot travel to another country to apply for a visa from there. You must submit a visa application in the country where you are a permanent resident. If you are already in a country other than where you live, you must clarify with the diplomatic mission whether you have strong and unforeseen reasons for still being able to apply.