modules in shiny package build not being recognized as functions

I'm using golem to create a shiny app that will build as a package.

Following the (fantastic) guide here, I have all the pre-requisite files ready to be built in R/:


I have two modules (mod_*.R above) that I use to do a simple data selection and then visualization. However, when I go to build the package, I get this error message:

It appears that the module function in app_ui.R is not being sourced during the build, although it was my understanding that having the module functions in R/ would mean that sourcing files wouldn't be necessary.

Am I mistaken? Has anyone run into this issue before?

I used golem::add_module() to create the module functions. Here's one of them:

#' 02_ts_vis UI Function
#' @description A shiny Module.
#' @param id,input,output,session Internal parameters for {shiny}.
#' @noRd 
#' @importFrom shiny NS tagList 
mod_02_ts_vis_ui <-function(id) {
  ns <- shiny::NS(id)
#' 02_ts_vis Server Function
#' @noRd 
mod_02_ts_vis_server <- function(input, 
                                 plot1vars) {
  ns <- session$ns
  plot1_obj <- reactive({
    # Get variable names
    variable <- rlang::sym(plot1vars$variable())
    ylabel <- switch(plot1vars$variable(),
                     "ppt" = "Precipitation (ml)",
                     "avg.t" = "Avg. temperature (°C)",
                     "min.t" = "Minimum temperature (°C)",
                     "avg.rh" = "Avg. Relative Humidity",
                     "min.rh" = "Min. Relative Humidity",
                     "max.rh" = "Max Relative Humidity"
    if (!is.null(plot1vars$station())){
      df <- vcrshiny::meteorology %>% 
        dplyr::filter(station %in% plot1vars$station())
    } else {
      df <- vcrshiny::meteorology
    #plot data
    p <- ggplot(data = df) +
      geom_line(aes(x = datetime, y = get(paste(variable)),
                    color = station)) +
      theme_bw() +
  output$plot1 <- renderPlotly({
## To be copied in the UI
# mod_02_ts_vis_ui("02_ts_vis_ui_1")
## To be copied in the server
# callModule(mod_02_ts_vis_server, "02_ts_vis_ui_1")



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