When you connect the barcode scanner device with an OTG cable directly to your android device. Automatically barcode scanner will be considered as a data input device, so the virtual keyboard on your android device will be inactive.
To re-enable the virtual keyboard on your Android device. You need to enable it in your device settings.
Please note that the virtual keyboard settings menu is different for each device.
The following tutorial uses a screenshot reference from Redmi Note 11
Open Settings on your Device then select Additional Settings
Select Language & Input
Select Keyboard, mouse, and track pad
Enable Use on-screen keyboard
Yeaaayyy! you have successfully activated the virtual keyboard