# PythonCall equivalent to PyCall's pytype\_mapping?

**URL:** <https://discourse.julialang.org/t/pythoncall-equivalent-to-pycalls-pytype-mapping/77086>\
**Category:** General Usage\
**Tags:** pythoncall\
**Created:** [February 25, 2022, 5:37pm UTC](https://discourse.julialang.org/t/pythoncall-equivalent-to-pycalls-pytype-mapping/77086 "2022-02-25T17:37:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![j\_verzani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j_verzani/32/8551_2.png) [@j\_verzani](https://discourse.julialang.org/u/j_verzani)\
**Post date:** [February 25, 2022, 5:37pm UTC](https://discourse.julialang.org/t/pythoncall-equivalent-to-pycalls-pytype-mapping/77086/1 "2022-02-25T17:37:24Z")

</div>

In `SymPy.jl` there is use of `PyCall`’s `pytype_mapping` to automatically convert sympy objects in Python into a typed object in Julia. It looks like in `PythonCall`, the `pyconvert_add_rule` does something similar, but I can’t seem to get it to work. I thought something like: `PythonCall.pyconvert_add_rule("sympy.core.basic.Basic", Sym, (args...) -> print("hi"), 100)` might show me what is needed to replace `pytype_mapping(sympy_core.basic.Basic, Sym)` but I’m pretty sure I’m am not specifying the first argument correctly (the underlying python type). Anyone able to offer guidance here?
