I made a function which creates plotly figure and applied for loop on it.
def doplot(df, somenumber): forplot = some_preprocessing_function(df,somenumber) fig