Edit Mode changes the view

Edit Mode changes the view

So using Deluge script I was able to hide parts of a form but when I got to edit mode the entire form shows up is there a way to make the script work even when juist viewing it in edit mode?