Renderplotly working in Rstudio but not in vscode

When I try this code in Rstudio, it works perfectly fine, but when i try this in vscode, I am not getting the second plot. Please find the code and screenshots below.

title: "Flexdashboard with Individual Sidebar Inputs for Each Graph"
    orientation: columns
    vertical_layout: fill
runtime: shiny

```{r setup, include=FALSE}

Column {data-width=650}

Chart A

plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length,
color= ~Species, type = "scatter", mode = "markers")

Column {data-width=350}

Chart B

# Sidebar input for graph 2
            label = "Select Variable 2:",
            choices = c("mpg", "disp", "hp"),
            selected = "mpg")
# Plotly chart for Tab 2
plot_ly(data = mtcars, x = ~mpg, y = ~get(input$var2), color = ~cyl, type = "scatter", mode = "markers")

[This is from Rstudio]

[This is the screenshot of rendered HTML from vscode]

As you can see I can't get the second plot in the rendered HTML from vscode. Please help me in resolving this issue. I need to use vscode to execute my upcoming dashboards.