I'm completely new to scripting, just started watching my first tutorial on this matter and the tutor in the video uses the built-in python scripting view, but has to copy and paste lines of code into the console to add the folder, that contains both the script and all associated files, and another line of code every time he updates the script outside of blender and also every time he restarts blender. I've found it more convenient to load the script into Text View, where I can even edit and update it more easily, but I can't seem to get Blender to load and save files, that are in the same folder as the script itself just by specifying their name, it only seems to work, when I specify the whole path. The instructor uses the command bpy.data.filepath to specify the filepath, but every time I try this, I get an error both in Intellij and in blender's text view, telling me, that bpy couldn't be found, in blender's python console, the command works just fine.
Any help or pointers in the right direction will be much appreciated.