Pysimplegui multiline

Hi. Need some help with multiline.

I have a def function that create an interface and uses multiline to populate the file contents into it.

def LoginScreen():
global …
loginlayout = [

[sg.Frame(’’,[[sg.Multiline(key=’-ml-’+sg.WRITE_ONLY_KEY, size=(131,15)) ]] )]
window = sg.Window(‘Login’, loginlayout, size=(1000,600))

def ViewFileinMultiFileArea():
global …
line = ‘ABCDEFGH’

def main():

the problem is: if I put this line
within the loginscreen, it works and populates the mainline.
But the same line in ViewFileinMultiFileArea does not work.

it gives error like:
TclError: Invalid command name “.!toplevel134.!frame8.!labelframe.!frame.!frame.!scrolledtext”

and it gives error pointing at this line itself:

Any help is really much appreciated.

I found the solution.

I was calling both the functions above (LoginScreen and ViewFileinMultiFileArea) from main function. Instead I called ViewFileinMultiFileArea from LoginScreen and it worked. In fact, now I do not need this line:
just print(line) works and it display in the multiline area