How to generate/create a new file in the same folder of a function?

I know that the below code will create record.txt it in the default directory of julia.

io = open("record.txt", "w")

However, I have a function called Myfile (in which I will share it with others). So, I need to add in it a code to create a record.txt in its folder (since I dont know in future in which directory it will be located), How can I do that?

@__DIR__ is your friend.

help?> @__DIR__
  @__DIR__ -> AbstractString

  Expand to a string with the absolute path to the directory of the file containing the
  macrocall. Return the current working directory if run from a REPL or if evaluated by
  julia -e <expr>.

Thank you very much!