# PyCall dot access

**URL:** <https://discourse.julialang.org/t/pycall-dot-access/21331>\
**Category:** New to Julia\
**Created:** [March 1, 2019, 6:35am UTC](https://discourse.julialang.org/t/pycall-dot-access/21331 "2019-03-01T06:35:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [March 1, 2019, 6:35am UTC](https://discourse.julialang.org/t/pycall-dot-access/21331/1 "2019-03-01T06:35:17Z")

</div>

As I understand, PyCall documentation says that it supports dot-access to Python object attributes:

> Given `o::PyObject` , `o.attribute` in Julia is equivalent to `o.attribute` in Python, with automatic type conversion.

However, even a very simple example of that fails:

```julia
using PyCall
@pyimport matplotlib.pyplot as plt
plt.gca().set_aspect("equal") # ERROR: type PyObject has no field set_aspect
plt.gca()[:set_aspect]("equal") # works

```

Do I misunderstand something in how Julia and/or PyCall work?

---

<div class="post-metadata">

**Author:** ![marius311](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marius311/32/3953_2.png) [@marius311](https://discourse.julialang.org/u/marius311)\
**Post date:** [March 1, 2019, 7:44am UTC](https://discourse.julialang.org/t/pycall-dot-access/21331/2 "2019-03-01T07:44:12Z")

</div>

You need to be on the PyCall master branch for this feature, none of the tagged releases have this yet. Try running `add PyCall#master` from the package prompt.

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [March 1, 2019, 7:47am UTC](https://discourse.julialang.org/t/pycall-dot-access/21331/3 "2019-03-01T07:47:53Z")

</div>

Elaborating a bit more, when you navigate to a package’s github repository you see the current master branch by default. This includes the `README.md`. On master, dot access is possible as in python. I made a [big PR](https://github.com/JuliaPy/PyCall.jl/pull/517) for that which got merged some time ago. However, there are a [couple of things left to do](https://github.com/JuliaPy/PyCall.jl/issues/629) before this makes a new consistent release. Hence a new PyCall version hasn’t been tagged yet.

As @marius311 mentioned, you can use `add PyCall#master` to checkout the bleeding edge version of PyCall to try out the dot access feature already.

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [March 1, 2019, 7:52am UTC](https://discourse.julialang.org/t/pycall-dot-access/21331/4 "2019-03-01T07:52:22Z")

</div>

In fact, turns out @stevengj released a new PyCall 1.9 version two days ago: [Releases · JuliaPy/PyCall.jl · GitHub](https://github.com/JuliaPy/PyCall.jl/releases)

So, no need for checking out `#master` anymore.

---

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [March 1, 2019, 11:48am UTC](https://discourse.julialang.org/t/pycall-dot-access/21331/5 "2019-03-01T11:48:38Z")

</div>

Thank you for pointing at version difference, didn’t notice that. Indeed, I had an older version than 1.9.
