Hi. im trying to append a text file that is created by another class via another class which are threads.
for example, i have :
class AClass(QThread):
def run(self):
with open("Log.txt", "w") as h:
h.write("Blabla \n")
class BClass(QThread):
def run(self):
with open("Log.txt", "a") as t:
t.write("new line of txt \n")
However, when BClass doesn't append the new line. but if its a new file say "LogF.txt" it will append to that new file. I tried using a+
too but no go. im assuming because they are running at the same time or smtg like that so BClass can't append to Log.txt because to BClass that file doesn't exist? How would i get around that? theres a function, isAlive()
but i think my googling skills are weak coz i can't find any sort of documentation about it, so im not sure how to use it or if it will resolve my issue. Any help is greatly appreaciated.