Can-a-person-travelling-in-aeroplane-take-a-selfie-by-getting-out-from-the-window

A co pilot who was outside the cockpit window during flight? Of course it is possible. And has happened before, although the pilot in question was in no condition to take a selfie.
This is the story of British Airways 5390. The cockpit windscreen burst open at cruising altitude and the pilot was sucked out of the cockpit due to the pressure difference inside the cabin and the atmosphere. The odds of survival at that altitude is almost nil due to various factors like low atmospheric pressure, low oxygen, freezing temperatures and not to mention the high speed of the aircraft. Miraculously, the pilot survived the incident.
This incident has also been filmed as an Aircrash Investigations episode by National Geographic.