Just add reversescale = True to your plot definition and the colorscale is reversed.
import plotly
plotly.offline.init_notebook_mode()
trace = plotly.graph_objs.Heatmap(z=[[1, 20, 30],
[20, 1, 60],
[30, 60, 1]],
reversescale=True)
plotly.offline.iplot([trace])

Just add reversescale = True to your plot definition and the colorscale is reversed.
import plotly
plotly.offline.init_notebook_mode()
trace = plotly.graph_objs.Heatmap(z=[[1, 20, 30],
[20, 1, 60],
[30, 60, 1]],
reversescale=True)
plotly.offline.iplot([trace])

For anyone else looking for this like me: contrary to Sheldores comment to the OP, for me adding '_r' to the colorscale name as described here worked perfectly fine. However, I think this was probably changed in plotly since then. Compare the two following figures:
import plotly.graph_objs as go
import plotly.plotly as py
import numpy as np
y_data = np.random.randn(500)
color_data = np.random.randn(500)
fig1 = go.Figure(go.Scatter(
y = y_data,
mode='markers',
marker=dict(
size=16,
color = color_data, #set color equal to a variable
colorscale='Viridis',
showscale=True
)
))
fig2 = go.Figure(go.Scatter(
y = y_data,
mode='markers',
marker=dict(
size=16,
color = color_data, #set color equal to a variable
colorscale='Viridis_r',
showscale=True
)
))
fig1.show()
fig2.show()
My plotly version is 4.11.0
The colorscales in px.colors are all simple lists, meaning you can use color_continuous_scale=px.colors.diverging.RdYlGn[::-1]
(I should add that the reason you're seeing an error like this is that since px.colors.diverging.RdYlGn is a list, px.colors.diverging.RdYlGn.reverse is defined, so you're currently trying to pass in a function to an argument that expects a string or a list)
Adding _r to the palette name now works (notebook).
import plotly.express as px
gapminder = px.data.gapminder()
fig = px.choropleth(gapminder, locations="iso_alpha",
color="lifeExp", hover_name="country",
animation_frame="year",
range_color=[20,80],
color_continuous_scale='RdYlGn_r')
fig.show()
