This is a tricky situation: I have a Chinese passport, currently residing in the US (have a US green card). My company in the US is sending me to Northern Ireland to work for 3 months (September to December), so I have a type D tier 2 UK visa that’s valid from September though December. I plan on traveling end of December to France and other Schengen countries once I leave the UK, and will return to the US afterwards. Since I can’t apply for the Schengen visa more than 3 months in advance, the question is: can I start apply for the Schengen visa when I get to UK? Whoever knows the answer to this must be a travel expert!
Usually you must apply for Schengen visas from the country where you're resident. However, a consulate in a different country where you are legally present may still agree to to process your application, if you can justify to them that you have a really good reason not to apply from your country of residence.
This is a judgment call by the consulate that cannot quite be predicted, but there are some example cases in the Consular Handbook, one of which sounds more or less parallel to your situation:
Example: A Peruvian artist is scheduled to perform in Portugal on 25.5., and from 20.2. to 15.5 she is performing in Canada and the United States.
Under such circumstances a Portuguese consulate in Canada or the United States should allow the applicant to submit the application,because it would be impossible for her to apply while still in her country of residence given the rule of not applying for a visa earlier than three months before the date of the intended entry into the territory of the Member States.