Relevant code is after the 'added this line' comment. Also, you'll need to import Text.Julius.
playSongWs :: SongId -> WebSocketsT Handler () playSongWs sid = do app <- getYesod let writeChan = songLine app readChan <- (liftIO . atomically) $ dupTChan writeChan lift $ startSongThread sid (forever $ (liftIO . atomically) (readTChan readChan) >>= sendTextData) getPlaySongR :: SongId -> Handler Html getPlaySongR sid = do webSockets $ playSongWs sid mbsong <- runDB $ get sid -- added this line: load the script let _ = $(juliusFileReload "templates/playback.julius") case mbsong of (Just song) -> defaultLayout $ do aDomId <- newIdent setTitle "Song Playback!" $(widgetFile "playback") Nothing -> error "song not found"