If i do this
X_train1 = resample(X_train, n_samples = 40, random_state = 1)
Y_train1 = resample(Y_train, n_samples = 40, random_state = 1)
will it be taking the exact same n_samples because they are both set to random_state = 1?
No, this cannot be guaranteed.
In your case, you can use this:
X_train1, y_train1 = resample(X_train, y_train, n_samples = 40, random_seed=1)
random_seed
fixed to reproduce code on another machine or after a kernel restart.