SimpleHTTPRequestHandler x files python processing

I am using the class (SimpleHTTPRequestHandler) to read directories and files (.html) that work perfectly well and are redenried naturally by the browser.

The problem is that I need to make files with extensions (.py) processed and sending the output in (html) so that the browser can render the received html.

I try to do this using the class (SimpleHTTPRequestHandler) and passing the path of the python file (index.py) and the result I get in the browser and the pure python code? Below is the server code and the class that returns the html:

Excerpt from the class : SimpleHTTPRequestHandler

...
class ROOTDirectory(SimpleHTTPRequestHandler):
    pass

    def do_HEAD(self):
        pass

    def do_GET(self):

        self.path = "index.py"
        # Trigger the do_GET method of the SimpleHTTPRequestHandler class
        SimpleHTTPRequestHandler.do_GET(self)
...

Class : index.py output browser :

#! /usr/local/bin/python3.9


# Class name : Index -> Structure html page :
class Index:

    # Class method : Constructor -> Object Build :
    def __init__(self):
        pass

    # Class method : build ->  : Render code html :
    def view(self):

        # Variable : v_html5 -> Code Html
        v_html5 = """
        <!DOCTYPE html>
        <html lang="pt-BR">
        <head>
            <meta charset="UTF-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>Webstrucs Action</title>
        </head>
        <body>
            <h1>Action</h1>
            <p>
            Python Web Server For Asynchronous Requests<br>
            Active: active (running)<br>
            File: index.py
            </p>
        </body>
        </html>
        """
        return v_html5

o_html = Index()
o_html.view()