RNN keep Hidden state

Hi, I have a long sequence that I break into consecutive parts.
On training I feed the network these parts by the original order.
I would like to pass the hidden state between the parts, so It will be as similar as possible to inference time.
What is the correct way to do it?
If I try to initialize before the first part, I get an error when I try to do a backward pass on the second time.
what is the correct way to keep the hidden state between batches in RNN?

Please do not double post. I’ve locked this thread.