Repository: stable-diffusion-webui
Issue: [Bug]: Error trying to use a list argument from custom gradio UI in custom script
Labels: bug-report

### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

Writing a custom script... and I've encountered this a few times... crashing a1111 entirely, so I'm doing something wrong, and wanting to know the right way to do this.

Try to pass a list of values from Gradio UI function in custom script to run function in custom script.




### Steps to reproduce the problem

Gradio UI... custom script
Essentially, if I populate a list and attempt pass it along... so here's a minimal example.

 ```python
def ui(self, is_img2img):
        myvar = [] * 3   # just to point out the list pre-exists
        with gr.Blocks():
             with gr.Row():
                 myvar[1] = gr.Checkbox(label="Testing1", value=True)  # this isn't related to checkbox, same for other field types
                 myvar[2] = gr.Checkbox(label="Testing2", value=True)
                 myvar[3] = gr.Checkbox(label="Testing3", value=True)
        return [ etc, etc..., myvar ]

def run(self, p, ....   myvar,

```
and I get an error:
```
Traceback (most recent call last):
  File "...SD/stable-diffusion-webui/launch.py", line 361, in <module>
    start()
  File "...SD/stable-diffusion-webui/launch.py", line 356, in start
    webui.webui()
  File "...SD/stable-diffusion-webui/webui.py", line 205, in webui
    shared.demo = modules.ui.create_ui()
  File "...SD/stable-diffusion-webui/modules/ui.py", line 525, in create_ui
    custom_inputs = modules.scripts.scripts_txt2img.setup_ui()
  File "...SD/stable-diffusion-webui/modules/scripts.py", line 322, in setup_ui
    create_script_ui(script, inputs, inputs_alwayson)
  File "...SD/stable-diffusion-webui/modules/scripts.py", line 302, in create_script_ui
    control.custom_script_source = os.path.basename(script.filename)
AttributeError: 'list' object has no attribute 'custom_script_source'

```

and stops web.ui entirely, back to CLI

If I remove the myvar from the return and args in run, no error... so it's purely passing a list.  If myvar is not a list, no error.

### What should have happened?

correctly passing a list value from Gradio to the custom script, same as any other sort of value, as expected...

### Commit where the problem happens

0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8

### What platforms do you use to access the UI ?

Windows, Linux, MacOS, Android

### What browsers do you use to access the UI ?

Mozilla Firefox, Google Chrome, Brave, Microsoft Edge

### Command Line Arguments

```Shell
No
```


### List of extensions

No, happens regardless of extensions...

### Console logs

```Shell
error log provided above, happens even if I add variable to return/run, and Restart UI only:

To create a public link, set `share=True` in `launch()`.
Closing server running on port: 7860
Restarting UI...
Traceback (most recent call last):
  File "...SD/stable-diffusion-webui/launch.py", line 361, in <module>
    start()
  File "...SD/stable-diffusion-webui/launch.py", line 356, in start
    webui.webui()
  File "...SD/stable-diffusion-webui/webui.py", line 205, in webui
    shared.demo = modules.ui.create_ui()
  File "...SD/stable-diffusion-webui/modules/ui.py", line 525, in create_ui
    custom_inputs = modules.scripts.scripts_txt2img.setup_ui()
  File "...SD/stable-diffusion-webui/modules/scripts.py", line 322, in setup_ui
    create_script_ui(script, inputs, inputs_alwayson)
  File "...SD/stable-diffusion-webui/modules/scripts.py", line 302, in create_script_ui
    control.custom_script_source = os.path.basename(script.filename)
AttributeError: 'list' object has no attribute 'custom_script_source'
```


### Additional information

_No response_