I'm trying to run packet capture and testing with selenium, I would like both tasks to run at the same time. need a solution track

For what I did, I wrote two functions. One function that uses selenium for testing and another one with pyshark for capturing packets.