UE freezes when running the C++ class actor

Hi! I am doing a simulation scene in Unreal Engine and have few actors and also a camera actor. I am trying to control the camera actor with another actor in two ways : generate and read modes. So baiscally I want to make the camera actor follow the other actor and also write the positions to a csv file and take screenshots every tick, this is working however I also need to incoporate another method which is reaidng from the csv file instead and then recreating the same motions however for some reason my UE editor has been crashingf since I implemented the new code which kuind of weorked before but now uts causing the engine to completely freeze and even worse is that when I tried to simplify my code as much as possible still now the freeze is persisting, has anybody faced this situation before and what do you suggest I should do ? I appreciate the tips and advice !
Best regards.

You are probably running into io conflicts, wanting to read and write simultaneously to the same file. Note that file access is not instant,
To read:
you need to open the file, read the line at position, close the file
to write
you need to open the file,modify the file probably through an append, close the file

Every read and write it goes through all of the steps that are slower than a tick.
Your write is cutting into your read and vice versa. This is causing problems.

You need to change your way of accessing data.

Write to the csv file and in parallel write to a memory array of strings.
Read from the array and not the file (it will be in memory so no conflict)
If the csv file is only needed to read data in unreal then just focus on in memory access and ditch the file completely.

If reading is over the network then it will introduce even more latency so a file is really a bad idea.

Writing to a file on tick will cause degradation of SSD’s, not a good idea.