As already mentioned but wanted to stress the safety issue is if the sequence of changing over the panel power is not followed correctly (according to your method) it is possible that an accident can occur by you sending power thru you lines up to the utility pole and to any linemen working on the lines even far away. Yes, you could zap them. It's more technical than that but I wanted to get you to understand how dangerous it is.
Also mentioned, but want to stress again is using an extension cord and plugging it into a receptacle to power the panel. What you will end up with is what they call a "suicide cord". In order to plug the cord into a receptacle you will have to have the male end available for the receptacle. This male end exposes you or anyone plugging it in to electrical current on the ends of the prongs. Thus another zap possibility.
Fitter30 post #4 gave a nice example of what can be set up to accomplish what you want but there are other methods that are just as safe and actually can be done by a DIYer if you feel post #4 may be a bit too complicated for your ability.
You can install on the outside of your house a generator inlet. Run a line from the inlet to your panel. Install an interlock device on your panel so that the main breaker can not be on at the same time the generator breaker is on so that you will never send power up to the utility lines in error.
Doing it our way instead of your way will make it even easier for someone else other than yourself if you are not available (home at the time) to run the generator properly/safely if power goes out.