Scientists have found a promising way for astronauts to produce their own medicine when resupply from Earth is no longer possible.