I've been scripting for ArcGIS Pro at my new job for a few months now. I use PyCharm for my scripts with the arcgispro-py3 environment. I've noticed if I don't close down the project with the data I'm manipulating in my script, I'll get a data lock error. So, this makes me have to close and reopen it after the smallest scripting change and this adds so much unnecessary time. Is there anyway I can get around this?
You'll have to remove the layers from the Contents List to remove the locks and keep your project open. You may also have to right click and refresh the containing folder in the Catalog tree to refresh the data after your script has ran.