The house would need to be isolated from the grid while being powered by the generator.
I would not do the following because I wouldn't trust it, but as a matter of curiosity, what would be the catch in just turning off the mains switch at the fuse box, thus isolating the house, then making a power cord with two plugs and connecting the generator to any house circuit, using that to feed the rest? Of course you would have to be careful not to overload the generator, but even then the safety would just break the connection. What is it actually that makes this a very stupid idea? I'm sure there must be something I haven't thought of.