You may need to create a BaseTest class to make it accessible to all your test classes. I have an example applying an Abstract Factory to select the driver for each execution. Take a look at https://github.com/eliasnogueira/selenium-java-bootstrap
We have the same problem here. I did a research and found nothing in how to simulate or even inject an QR Code.
This test, here, is executed manually using the device and automated in the service layer.
I wish you can solve your problem :)
As I don't write code in Python and not using Robot Framework I, unfortunately cannot show an example to you.
But the way is the same: if you can take a screenshot and, after, resize the image with any Python library you'l succeed.
There is a gist embedded. Maybe it is not allowed due to some restrictions of your browser, maybe not…
So, the link is this: https://gist.github.com/eliasnogueira/e4c1cecdc17096cc62e04f6215e4308b#file-chromeheadlesstesten-java