# Is there an equivalent of "from \<modul\> import \*" in PyCall?

**URL:** <https://discourse.julialang.org/t/is-there-an-equivalent-of-from-modul-import-in-pycall/7960>\
**Category:** General Usage\
**Tags:** package, pycall, python\
**Created:** [December 24, 2017, 3:01am UTC](https://discourse.julialang.org/t/is-there-an-equivalent-of-from-modul-import-in-pycall/7960 "2017-12-24T03:01:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nha\_Dinh\_Cao](https://avatars.discourse-cdn.com/v4/letter/n/48db29/32.png) [@Nha\_Dinh\_Cao](https://discourse.julialang.org/u/Nha_Dinh_Cao)\
**Post date:** [December 24, 2017, 3:01am UTC](https://discourse.julialang.org/t/is-there-an-equivalent-of-from-modul-import-in-pycall/7960/1 "2017-12-24T03:01:53Z")

</div>

Hello everyone,

I have started using Julia and PyCall. I think that the @pyimport feature is very nice but sometimes I find it more useful if I can do something like “from import \*” like in Python. Is there any way I can do it?

Thank you.

---

<div class="post-metadata">

**Author:** ![tamasgal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamasgal/32/27946_2.png) [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Post date:** [December 24, 2017, 12:31pm UTC](https://discourse.julialang.org/t/is-there-an-equivalent-of-from-modul-import-in-pycall/7960/2 "2017-12-24T12:31:58Z")

</div>

There is no such functionality. But you can write a simple macro which will turn something like `@from numpy import abs` into `@pyimport numpy as numpy; abs = numpy.abs`.

**Please note that doing `from ... import *` is a really bad thing and you never should do that, let alone in case of mixing Python with other languages.**  
Every single top level definition and import which is present in that Python module will be loaded in the current (global) namespace and can potentially cause horrible side effects.

---

<div class="post-metadata">

**Author:** ![NaOH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/naoh/32/5632_2.png) [@NaOH](https://discourse.julialang.org/u/NaOH)\
**Post date:** [December 26, 2017, 1:53am UTC](https://discourse.julialang.org/t/is-there-an-equivalent-of-from-modul-import-in-pycall/7960/3 "2017-12-26T01:53:29Z")

</div>

Check out `ImportMacros.jl` for inspiration on how to implement similar macros that work with `PyCall.jl`:

[https://github.com/fredrikekre/ImportMacros.jl](https://github.com/fredrikekre/ImportMacros.jl)

I implemented `@from` if you have any doubts, feel free to ping me.
