The short answer
Before you make an offer, or straight after one is accepted. The earlier you know, the more choices you still have.
A Scan is worth most early: if it shows something serious, you still have options. Once solicitors are instructed and the mortgage valuation is under way, a late discovery already costs you money.