# How use python functions from my python file in Julia?

**URL:** <https://discourse.julialang.org/t/how-use-python-functions-from-my-python-file-in-julia/79977>\
**Category:** General Usage\
**Created:** [April 25, 2022, 8:31am UTC](https://discourse.julialang.org/t/how-use-python-functions-from-my-python-file-in-julia/79977 "2022-04-25T08:31:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 25, 2022, 11:41am UTC](https://discourse.julialang.org/t/how-use-python-functions-from-my-python-file-in-julia/79977/2 "2022-04-25T11:41:03Z")

</div>

> [@YitaoCai](#):
>
> In python we do like

In the `python` interpreter, the current directory `.` is in the path by default. When calling from Julia you need to add the directory to `sys.path` explicitly.

> [@How to load and call functions defined in a standalone Python script?](https://discourse.julialang.org/t/how-to-load-and-call-functions-defined-in-a-standalone-python-script/601/2):
>
> Just do what you would have done in python julia\> using PyCall julia\> push!(pyimport("sys")["path"], pwd()); julia\> pyimport("a")[:foo]() Hello world! 3

and (I think) similarly for PythonCall where you would do

```julia
pyimport("sys").path.append(pwd())

```

(And, of course, you need to do this in `python` as as well as soon as you want to run code that is not in the current directory or the regular path.)

---

_[View the full topic](https://discourse.julialang.org/t/how-use-python-functions-from-my-python-file-in-julia/79977)._
