Welcome to PF !
I would break the problem into time steps. Here is the basic procedure:
a) During the time step, assume the pressures in the two vessels are constant and figure out the flow rate.
b) Multiply the flow rate in Step 'a' by the timestep. This will be the quantity of gas that flowed during the time step.
c.1) Subtract the mass determined in Step 'b' from the higher pressure vessel.
c.2) Determine the new (lower) pressure in the higher pressure vessel with the perfect gas law. The pressure is lower since mass has left the vessel. Use the 'Z' compressibility factor if needed.
d.1) Add the mass determined in Step 'b' to the lower pressure vessel.
d.2) Determine the new (higher) pressure in the lower pressure vessel with the perfect gas law. The pressure is higher since mass has entered the vessel. Use the 'Z' compressibility factor if needed.
e) Go To Step 'a'. The difference in pressures is now lower and so will be the flow rate. Repeat until the two vessel pressures are equal. Add up all the time steps and this is the total time.