try the following code.
lst_val = []
class Sample:
def func(any_list):
global lst_val
for value in any_list:
lst_val.append(value)
return lst_val
Sample.func([1, 2, 3, 4])
print(lst_val)
1
solved Appending to the list outside function in python not changing the list [closed]