Skip to main content
Interactive libraries such as Plotly can emit HTML or JavaScript-backed notebook outputs. For the most portable workflow, save interactive charts as HTML files and download or serve them from the sandbox.
result = sandbox.run_code("""
import plotly.express as px

fig = px.line(x=[1, 2, 3], y=[1, 4, 9], title="Interactive chart")
fig.write_html("/workspace/chart.html")
fig.show()
""")

print(any(item.html or item.javascript for item in result.results))
Read the generated HTML directly:
html = sandbox.files.read("/workspace/chart.html")