Repository: gradio-app/gradio

Issue:
AttributeError: 'Blocks' object has no attribute 'progress_tracking'
### Describe the bug

from fastapi import FastAPI
import gradio as gr
app = FastAPI()
from ps import demo
from py import demo1
app = gr.mount_gradio_app(app, demo, path="/ps")
app = gr.mount_gradio_app(app, demo1, path="/py")


  File "D:\ProgramData\Anaconda3\lib\site-packages\starlette\routing.py", line 671, in lifespan
    async with self.lifespan_context(app):
  File "D:\ProgramData\Anaconda3\lib\site-packages\starlette\routing.py", line 566, in __aenter__
    await self._router.startup()
  File "D:\ProgramData\Anaconda3\lib\site-packages\starlette\routing.py", line 648, in startup
    await handler()
  File "D:\ProgramData\Anaconda3\lib\site-packages\gradio\routes.py", line 621, in start_queue
    gradio_app.get_blocks().startup_events()
  File "D:\ProgramData\Anaconda3\lib\site-packages\gradio\blocks.py", line 1667, in startup_events
    utils.run_coro_in_background(self._queue.start, (self.progress_tracking,))
AttributeError: 'Blocks' object has no attribute 'progress_tracking'

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Reproduction

3.15 ok 3.16 bug

### Screenshot

on

### Logs

```shell
on
```


### System Info

```shell
3.16
```


### Severity

annoying


Discussion:
Thanks for letting us know  @wuyuliyu !! 

Resolving patch:
diff --git a/gradio/blocks.py b/gradio/blocks.py
--- a/gradio/blocks.py
+++ b/gradio/blocks.py
@@ -513,6 +513,7 @@ def __init__(
         self.output_components = None
         self.__name__ = None
         self.api_mode = None
+        self.progress_tracking = None
 
         if self.analytics_enabled:
             self.ip_address = utils.get_local_ip_address()
@@ -1096,6 +1097,10 @@ def __exit__(self, *args):
             self.parent.children.extend(self.children)
         self.config = self.get_config_file()
         self.app = routes.App.create_app(self)
+        self.progress_tracking = any(
+            block_fn.fn is not None and special_args(block_fn.fn)[1] is not None
+            for block_fn in self.fns
+        )
 
     @class_or_instancemethod
     def load(
@@ -1313,10 +1318,6 @@ def reverse(text):
         self.height = height
         self.width = width
         self.favicon_path = favicon_path
-        self.progress_tracking = any(
-            block_fn.fn is not None and special_args(block_fn.fn)[1] is not None
-            for block_fn in self.fns
-        )
 
         if enable_queue is not None:
             self.enable_queue = enable_queue


Test patch:
diff --git a/test/test_routes.py b/test/test_routes.py
--- a/test/test_routes.py
+++ b/test/test_routes.py
@@ -203,6 +203,24 @@ def test_get_file_created_by_app(self):
         file_response = client.get(f"/file={created_file}")
         assert file_response.is_success
 
+    def test_mount_gradio_app(self):
+        app = FastAPI()
+
+        demo = gr.Interface(
+            lambda s: f"Hello from ps, {s}!", "textbox", "textbox"
+        ).queue()
+        demo1 = gr.Interface(
+            lambda s: f"Hello from py, {s}!", "textbox", "textbox"
+        ).queue()
+
+        app = gr.mount_gradio_app(app, demo, path="/ps")
+        app = gr.mount_gradio_app(app, demo1, path="/py")
+
+        # Use context manager to trigger start up events
+        with TestClient(app) as client:
+            assert client.get("/ps").is_success
+            assert client.get("/py").is_success
+
 
 class TestGeneratorRoutes:
     def test_generator(self):