If your program executing second.py file. How would you access variable with data of second.py file? [duplicate]

I've seen many post regarding this but doesn't found solution. You have first.py

def AI_click(self):
            string=""
            os.system('python second.py')
            self.lineEdit.setText(string) 

If this method called, second.py will execute. In second.py you have,

string="mntk"
        

How will you use second.py string in first.py function? I also asked here

This is nothing to do with import because in real second.py contain AI model and it predicts alphabets using ocr and store string value in variable. That's what I want to access in first.py

Back to Top