Line 123:33: ‘loadPyodide’ is not defined no-undef

Im trying to create a online coding exam software using React app.I have a language selector in my webpage with a code editor.When a user select certain language from language selector,then he have to write a code for a given question using that language.Now a problem is that,i want to execute the user python code with my own testcases using pyodide.But when i run it in browser,it says Line 123:33: ‘loadPyodide’ is not defined no-undef.I am unable to troubleshoot this error
`

import React, { useState, useRef, useEffect } from 'react';
import Editor from '@monaco-editor/react';
import { Box, HStack, Button, Text } from '@chakra-ui/react';
import LanguageSelector from './LanguageSelector';
import { CODE_SNIPPETS } from '../constants';
import Output from './Output';
import questions from './questions.json';



const CodeEditor = () => {
  const [value, setValue] = useState('');
  const [language, setLanguage] = useState('javascript');
  const [outputValue, setOutputValue] = useState('');
  const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0);
  const [test, setTest] = useState(''); // Define test state to store the test of the current question
  const [functions , setFunctions] = useState(''); //For storing the function associated with the question
  
  const marks = useRef(0)

  const editorRef = useRef(null);
  const randomQuestions = useRef([]);
  var totalquestion ;
  var marks_of_each_question = 2;

  const getRandomQuestions = () => {
    const tempRandomQuestions = [];
    while (tempRandomQuestions.length < 5) {
      const randomIndex = Math.floor(Math.random() * questions.questions.length);
      const randomQuestion = questions.questions[randomIndex];
      if (!tempRandomQuestions.find((q) => q.question === randomQuestion.question)) {
        tempRandomQuestions.push(randomQuestion);
      }
    }
    console.log(tempRandomQuestions)
    totalquestion = tempRandomQuestions;
    setTest(tempRandomQuestions[0].test); 
    setFunctions(tempRandomQuestions[0].functions); 
    return tempRandomQuestions;
  };

  useEffect(() => {
    randomQuestions.current = getRandomQuestions();
    setCurrentQuestionIndex(1);
  }, []);

  useEffect(() => {
    // Reset editor and output value when question changes
    setValue(CODE_SNIPPETS[language]);
    
  }, [currentQuestionIndex ,language]);

  const fetchQuestion = () => {
    setCurrentQuestionIndex((prevIndex) => {
      setTest(randomQuestions.current[prevIndex + 1].test); 
      // Bfor updating the CurrentQuestionIndex,Update test with the new question
      setFunctions(randomQuestions.current[prevIndex + 1].functions); 
      return prevIndex + 1;
    });
  };
  

  const onMount = (editor) => {
    editorRef.current = editor;
    editor.focus();
    setCurrentQuestionIndex(0);
  };

  const onSelect = (language) => {
    setLanguage(language);
    setValue(CODE_SNIPPETS[language]);
  };

  const logOutputValue = (output) => {
    setOutputValue(output);
  };

  const validateFunction =async (ICode , testCases , func) => {
    
    let functionRegex,findLargest;
     
    // ####FOR PYTHON#####################
    if (language === 'python') {
      
          
          const pyodide = await loadPyodide()
              let functionRegex, findLargest;

          
             
              functionRegex = new RegExp(`def\s+${func}\((.*?)\)\s*:\s*([\s\S]*?)(?=(?:\ndef\s+|\Z))`);

              
              const match = ICode.match(functionRegex);

              // Check if the function definition was found
              if (!match) {
                  throw new Error("Function not found");
              }

              
              const [, parameters, body] = match;

             
              const pythonCode = `
              def ${func}(${parameters}):
              ${body}
              `;

              // Execute the Python code to define the function
              window.pyodide.runPython(pythonCode);

              // Retrieve the function from the Python environment
              findLargest = window.pyodide.globals.get(func);

              // Log the created function
              console.log(findLargest);
            
      
    }
  
   

  
    return true; // Function passed all test cases
    };




  const handleSubmit = () => {
    // try{ ##########Make try catch block at last
     const currentQuestion = randomQuestions.current[currentQuestionIndex];
     console.log(currentQuestionIndex)
     console.log("currentQuestion.answer:", currentQuestion.answer);
     console.log("currentQuestion.test:", currentQuestion.test);
     console.log("currentQuestion.functions:", currentQuestion.functions);
     console.log("Output value:", outputValue);
     console.log("Language:", language);
    
     validateFunction(value,currentQuestion.test,currentQuestion.functions)

    
     
   
     if (currentQuestionIndex < randomQuestions.current.length - 1) {
       fetchQuestion();
       
     } else if (currentQuestionIndex === randomQuestions.current.length - 1) {
       window.location.href = "/Completed";
       alert("Congratulation! You got " + marks.current )
     }
  //  }
  //  catch(error){
  //   console.log("Error")
  //   console.log(error.message)
  //  }
  };

  return (
    <Box >
      <HStack spacing={2}>
        <Box w="50%">
          <LanguageSelector language={language} onSelect={onSelect} />
          <Text as="span" color="gray.500" fontSize="lg"  >
            {currentQuestionIndex < randomQuestions.current.length
              ? randomQuestions.current[currentQuestionIndex].question
              : 'End'}
          </Text>
          <Editor
            height="68vh"
            language={language}
            theme="vs-dark"
            defaultValue={CODE_SNIPPETS[language]}
            value={value}
            onChange={(value) => setValue(value)}
            onMount={onMount}
          />
          <Button mt={1} colorScheme="teal" onClick={handleSubmit} >
            Submit
          </Button>
        </Box>
        <Output editorRef={editorRef} language={language} passOutput={logOutputValue} value={value} test={test} functions = {functions}/>
      </HStack>
    </Box>
  );
};

export default CodeEditor;

`

I viewed the official documentation of pyodide.But i was not much helpful

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật