You can declare Global list on the file/module level like: my_global_list = list() in Python. If you want to append to it inside a function you can use the global keyword.
Example global list in Python
Simple example code.
aList =  def bar(): sublist = 1 aList.append(sublist) bar() print(aList)
Declare a global list and use it in function.
global a a = [1, 2, 3] def update_a(): del a[1:2] print(a) update_a()
Output: [1, 3]
Do comment if you have any doubts and suggestions on this Python list.
Note: IDE: PyCharm 2021.1.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.