Keyboard & mouse disconnecting

When I create a new C++ class for some reason my keyboard, mouse, headset and mic disconnects. (beside from mic everything else is wireless)

Nothing like this happens when I am playing games, I have also used unity before and never had compiling code causing this issue.

I recently started coding in unreal and noticed this was happening.

Any reason and solution to stop the disconnection issue.

Note: the things disconnect and reconnects after few seconds.