# Using isdefined to check where a function is defined

**URL:** https://discourse.julialang.org/t/using-isdefined-to-check-where-a-function-is-defined/37536
**Category:** General Usage
**Tags:** cxx
**Created:** [April 13, 2020, 11:18pm UTC](https://discourse.julialang.org/t/using-isdefined-to-check-where-a-function-is-defined/37536 "2020-04-13T23:18:42Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![jstrube](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jstrube/32/525_2.png) [@jstrube](https://discourse.julialang.org/u/jstrube)
#### Post date: [April 14, 2020, 1:40am UTC](https://discourse.julialang.org/t/using-isdefined-to-check-where-a-function-is-defined/37536/3 "2020-04-14T01:40:34Z")

</div>

> [@yuyichao](#):
>
> Just define it?

Right. That works, except if you define it in an included file. See also this related question [Trying not to overload Base.open - #4 by Sukera](https://discourse.julialang.org/t/trying-not-to-overload-base-open/37432/4), where @Sukera demonstrated how you can trigger this by “just defining it”.  
This is the case here: CxxWrap builds the list of names that are defined on the C++ side and imports them into the current module. That’s what triggers this error.  
The code for importing the list of names is here: [https://github.com/JuliaInterop/CxxWrap.jl/blob/master/src/CxxWrap.jl#L451-L457](https://github.com/JuliaInterop/CxxWrap.jl/blob/master/src/CxxWrap.jl#L451-L457)  
The `isdefined` guard was put in place to fix a bug:  
[set\_override\_module within add\_type\<Parametric...\>().apply\<...\> · Issue #199 · JuliaInterop/CxxWrap.jl · GitHub](https://github.com/JuliaInterop/CxxWrap.jl/issues/199)  
The question is if there’s a way to import the names from the C++ module without triggering the error.  
See also the discussion here: [Change in name resolution leads to clash with Base.open · Issue #226 · JuliaInterop/CxxWrap.jl · GitHub](https://github.com/JuliaInterop/CxxWrap.jl/issues/226)

---

_[View the full topic](https://discourse.julialang.org/t/using-isdefined-to-check-where-a-function-is-defined/37536)._
