It is possible, but it is not recommended.
If there is a power outage to the city's power grid and the main switch is turned down, it means that the home grid is disconnected from the city's power supply. Then connect your own generator to the home network, which meets the circuit operating conditions and will not cause short circuit failure.
Why is this not recommended?
Although there are no problems with the wiring, there is a lack of devices and measures to ensure safety.
You should know that when the generator is working and mains power is supplied, if anyone 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 electricity grid and must operate separately. The usual approach is:
Use a disProfessional two-power junction to ensure that only one power supply can be connected at any time (with an internal locking device).