It is possible, but not recommended.
If there is a power outage from the city power grid and the main switch is pulled down, it means that the home network is disconnected from the city power supply. Then connect your own generator to the home network so that it meets the working conditions of the circuit and will not cause short circuit failure.
Why is this not recommended?
Although there is no problem with the wiring, there is a lack of devices and measures to ensure safety.
You must know that when the generator is working and the mains power is supplied, if someone closes the main switch by mistake, the generator will be destroyed and cause huge losses.
Because your own small generator cannot be connected to the mains grid and must work separately. The usual approach is:
Use a professional two-power circuit breaker to ensure that only one power supply can be connected at any time (with an internal interlock device).