Can you use USB OTG and charge at the same time? I have a Google pixel-2.

I like to use a Bluetooth keyboard and wired mouse via the USB-C-OTG canoe that came with the phone... But then I can't charge the phone.

I wanted to buy something... To let me use the USB OTG and charge the phone at the same time.

Can you use USB OTG and charge at the same time?

I was thinking get a gadget that does USB-C to USB-A and USB-C... Where the USB-C would be for charging and the USB-A would be for a hub for the quoted keyboard and mouse.
I've found that that feature depends on the kernel. So wether your phone can charge and use OTG depends on the kernel on your phone. If it doesn't support it out of the box, you can try to find and flash a custom kernel with that functionality. The OTG cable also plays an important factor.

However, similar question was asked about the Nexus 7, which doesn't have support, it is highly likely that your Pixel 2 also doesn't support it.

This should answer your question and give you more insights of how and why.