# PyCall question

**URL:** <https://discourse.julialang.org/t/pycall-question/9472>\
**Category:** New to Julia\
**Created:** [March 3, 2018, 2:38am UTC](https://discourse.julialang.org/t/pycall-question/9472 "2018-03-03T02:38:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tk3369](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tk3369/32/2824_2.png) [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Post date:** [March 3, 2018, 2:38am UTC](https://discourse.julialang.org/t/pycall-question/9472/1 "2018-03-03T02:38:58Z")

</div>

It seems that PyCall does not support class methods? e.g.

```julia
julia> using PyCall

julia> @pyimport datetime

julia> datetime.date(2018,1,1)
2018-01-01

julia> datetime.date.today()
ERROR: type PyObject has no field today

```

Ref: [8.1. datetime — Basic date and time types — Python 3.6.15 documentation](https://docs.python.org/3.6/library/datetime.html#datetime.date)

---

<div class="post-metadata">

**Author:** ![ssfrr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ssfrr/32/3736_2.png) [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Post date:** [March 3, 2018, 2:47am UTC](https://discourse.julialang.org/t/pycall-question/9472/2 "2018-03-03T02:47:34Z")

</div>

From the [README](https://github.com/JuliaPy/PyCall.jl#usage):

> Important: The biggest difference from Python is that object attributes/members are accessed with `o[:attribute]` rather than `o.attribute`, so that `o.method(...)` in Python is replaced by `o[:method](...)` in Julia.

Try `datetime.date[:today]()` and see if that works.

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [March 3, 2018, 5:10am UTC](https://discourse.julialang.org/t/pycall-question/9472/3 "2018-03-03T05:10:14Z")

</div>

If PyCall overloads `getfield` in v0.7, that would really cool since pieces of code and tutorials can then be copied over from Python to Julia with few changes.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 3, 2018, 10:28am UTC](https://discourse.julialang.org/t/pycall-question/9472/4 "2018-03-03T10:28:02Z")

</div>

It will.
