You can use the python function hasattr() to find whether an attribute/method is present in an object. It will return True if the attribute is present in the object, otherwise, False.
Here is an example to check if "split" method is present in StratifiedKFold():
from sklearn.model_selection import StratifiedKFold
skf = StratifiedKFold(n_splits=2)
if not hasattr(skf, "split"):
print("split method is not found")
print("split method is found")
Since StratifiedKFold has split() method, the code will execute the else part.