Hello, I have 4 files. They are:
globalVariables.py - this stores variables that are used in other modules
returnCWD.py - this has a function that returns the current working directory
listCWD - this has a function that prints a list of all items within the current working directory
returnFileList - this file imports the 3 files above and runs the function from returnCWD.py and
the function from listCWD.py
My problem
In order to import the listCWD module I had to add this piece of code
but this code then prevents me from calling the listCWD function.
Can anyone help with this. I have attached a url link to the files.
My 4 python files within a folder
Thanks in advance to anyone who takes the time to help out.
globalVariables.py - this stores variables that are used in other modules
returnCWD.py - this has a function that returns the current working directory
listCWD - this has a function that prints a list of all items within the current working directory
returnFileList - this file imports the 3 files above and runs the function from returnCWD.py and
the function from listCWD.py
My problem
In order to import the listCWD module I had to add this piece of code
if __name__ == '__main__':to the listCWD function in the listCWD.py file to prevent the listCWD.py file from running on import
but this code then prevents me from calling the listCWD function.
Can anyone help with this. I have attached a url link to the files.
My 4 python files within a folder
Thanks in advance to anyone who takes the time to help out.