# Julia Python equivalent of \_\_main\_\_?

**URL:** <https://discourse.julialang.org/t/julia-python-equivalent-of-main/35433>\
**Category:** New to Julia\
**Created:** [March 2, 2020, 10:50pm UTC](https://discourse.julialang.org/t/julia-python-equivalent-of-main/35433 "2020-03-02T22:50:42Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [March 2, 2020, 10:53pm UTC](https://discourse.julialang.org/t/julia-python-equivalent-of-main/35433/2 "2020-03-02T22:53:25Z")

</div>

See [Frequently Asked Questions · The Julia Language](https://docs.julialang.org/en/v1/manual/faq/#How-do-I-check-if-the-current-file-is-being-run-as-the-main-script?-1). Something like the following should work:

```julia
function main()
   # do stuff
end

if abspath(PROGRAM_FILE) == @ __FILE__
    main()
end

```

---

_[View the full topic](https://discourse.julialang.org/t/julia-python-equivalent-of-main/35433)._
