@JonB Very Good Suggestion, I used a second variable in the other function to read the opened file(s) from the first function and it did work like a charm. Thanks. Here is an update to the code
def encryption_hash(self,comboBox_2): index = self.comboBox_2.currentIndex() path = self.fname_E with open(path, 'rb') as f: if index == 2: hasher1 = hashlib.md5() afile1 = f buf1 = afile1.read() a = hasher1.update(buf1) md5 =(str(hasher1.hexdigest())) self.lineEdit_E.setText("File Hash Using MD5: " + md5)