Parallel processing in R shiny, calling python script

Hi, I am trying to do parallel processing in R shiny, the parallel task which I want to do is a call to python script. However it does not work and not able to fetch the result back from python to R.

Below is the sample R shiny and Python code.

App.R

library(shiny)
library(reticulate)
library(doParallel)
library(foreach)
ui <- fluidPage(
   
   # Application title
   titlePanel("Sample Program"),
      
      mainPanel(
         uiOutput("txtValue")
      )   
)
server <- function(input, output) {
   
  source_python("../../PythonCode/Multiprocessing/multip.py")  
 
  cl <- makeCluster(detectCores(), type='PSOCK')
  registerDoParallel(cl)
  
  result <- foreach(i=1:5) %dopar% fsq(i)
  stopCluster(cl)     
   output$txtValue <- renderUI({
    result   
   }) 
     
}
shinyApp(ui = ui, server = server)

Python Code (multip.py)

def fsq(x):
    return x**2