from qiskit_ibm_runtime import Batch, SamplerV2 as Sampler
# Create batch
batch = Batch(backend=backend, max_time="5m")
sampler = Sampler(mode=batch)
# Submit some jobs
job1 = sampler.run([circuit1])
job2 = sampler.run([circuit2])
# Close batch
batch.close()
# Try to submit another job
job3 = sampler.run([circuit3])