How to create a list and append to list inside a mqtt and GUI program?

Richard Damon Richard at Damon-Family.org
Sun Sep 1 20:44:45 EDT 2019


On 9/1/19 4:02 PM, Spencer Du wrote:
> Hi 
>
> I have code for GUI and MQTT. In GUI.py I have "def loadGUI" which loads up a GUI file if the file exists in current directory. I want to add the file name to a list when a file is imported and for each subsequent file that is imported I want the file name to be imported to the same list and print the list or create a new list but with the imported file named added to list which has the existing file names that have already been imported. I was wondering how I do this. By the way run GUI.py to test this and test1.py and test2.py are the files which can be used to import GUI . 

To make the list persistent you need to create it as a module global or
as a class member of a persistent object (like your MainWindow)

-- 
Richard Damon




More information about the Python-list mailing list