I don't think it is possible to get it directly but we may utilize the random seed.
random_stateint, RandomState instance or None, default=None
Controls both the randomness of the bootstrapping of the samples used when building trees (if bootstrap=True)
This is from the RF Github code
def _generate_sample_indices(random_state, n_samples, n_samples_bootstrap):
"""
Private function used to _parallel_build_trees function."""
random_instance = check_random_state(random_state)
sample_indices = random_instance.randint(0, n_samples, n_samples_bootstrap)
return sample_indices
So, we can get these with a custom code if we fixed the seed above e.g. for 2 Tree,
import pandas as pd, numpy as np
num = 20 # max index
np.random.seed(0) # Fix the seed
sample_1 = np.random.randint(0,num,(1,num))
oob_1 = [elem for elem in np.arange(num) if elem not in sample_1 ]
sample_2 = np.random.randint(0,num,(1,num))
oob_2 = [elem for elem in np.arange(num) if elem not in sample_2 ]
Please verify it with a custom code. I have not verified it.