# Name of julia source file?

**URL:** <https://discourse.julialang.org/t/name-of-julia-source-file/25246>\
**Category:** General Usage\
**Created:** [June 13, 2019, 1:21pm UTC](https://discourse.julialang.org/t/name-of-julia-source-file/25246 "2019-06-13T13:21:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidR](https://avatars.discourse-cdn.com/v4/letter/d/3ab097/32.png) [@DavidR](https://discourse.julialang.org/u/DavidR)\
**Post date:** [June 13, 2019, 1:21pm UTC](https://discourse.julialang.org/t/name-of-julia-source-file/25246/1 "2019-06-13T13:21:43Z")

</div>

How can I obtain the name of the current (or main/top) julia source file, from within the code?

---

<div class="post-metadata">

**Author:** ![tanhevg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tanhevg/32/12025_2.png) [@tanhevg](https://discourse.julialang.org/u/tanhevg)\
**Post date:** [June 13, 2019, 1:56pm UTC](https://discourse.julialang.org/t/name-of-julia-source-file/25246/2 "2019-06-13T13:56:57Z")

</div>

`Base.source_path()`

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [June 13, 2019, 2:10pm UTC](https://discourse.julialang.org/t/name-of-julia-source-file/25246/3 "2019-06-13T14:10:19Z")

</div>

I’m not sure if you are asking about the source code of functions, but if that’s the case, you can find the path of all the methods of any function `f` with `methods(f)`

---

<div class="post-metadata">

**Author:** ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Post date:** [June 13, 2019, 2:15pm UTC](https://discourse.julialang.org/t/name-of-julia-source-file/25246/4 "2019-06-13T14:15:56Z")

</div>

There are also `@ __FILE__ ` and `PROGRAM_FILE`:

```julia
help?> @ __FILE__
  @ __FILE__ -> AbstractString

  Expand to a string with the path to the file containing the macrocall, or
  an empty string if evaluated by julia -e <expr>. Return nothing if the
  macro was missing parser source information.
  Alternatively see PROGRAM_FILE.

```

```julia
help?> PROGRAM_FILE
search: PROGRAM_FILE

  PROGRAM_FILE

  A string containing the script name passed to Julia from the command
  line. Note that the script name remains unchanged from within included
  files. Alternatively see @ __FILE__.

```
