How to get the value of variable from another R script

I'm working on a dashboard with the shiny library and I've managed to create a function that tells me which tab I'm on currently. The problem is that I can't call this function with my other script


# Define UI for application that draws a histogram
ui <- fluidPage(
  # Application title
  # Sidebar with a slider input for number of bins 
                  "Number of bins:",
                  min = 1,
                  max = 50,
                  value = 30)
    # Show a plot of the generated distribution
      # Output: Tabset w/ plot, summary, and table
      tabsetPanel(id = "tabs",
                  tabPanel("Plot", plotOutput("ID1")),
                  tabPanel("Summary", verbatimTextOutput("ID2")),
                  tabPanel("Table", tableOutput("ID3")),

# Define server logic required to draw a histogram
server <- function(input, output) {
  observeEvent(input$tabs, {
    print(paste("You clicked tab:", input$tabs))
# Run the application 
shinyApp(ui, server)

In the other program, I tried to call the function but it didn't succeed.

  observeEvent(input$tabs, {
    print(paste("You clicked tab:", input$tabs))
} ```

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.