# FFTW doesn't work in a module

**URL:** <https://discourse.julialang.org/t/fftw-doesnt-work-in-a-module/98812>\
**Category:** General Usage\
**Tags:** fftw\
**Created:** [May 13, 2023, 7:56pm UTC](https://discourse.julialang.org/t/fftw-doesnt-work-in-a-module/98812 "2023-05-13T19:56:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adamslc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adamslc/32/3452_2.png) [@adamslc](https://discourse.julialang.org/u/adamslc)\
**Post date:** [May 13, 2023, 7:56pm UTC](https://discourse.julialang.org/t/fftw-doesnt-work-in-a-module/98812/1 "2023-05-13T19:56:30Z")

</div>

`FFTW` has me thoroughly confused. Consider the following code:

```julia
using FFTW
fft(rand(10))

module Testing
using FFTW

f() = fft(rand(10))
export f
end

using .Testing
f()

```

The `fft` in the global scope works just fine. However, `f` errors with

```julia
ERROR: LoadError: MethodError: no method matching plan_fft!(::Vector{Float64}, ::Un
itRange{Int64})

```

I gather that this issue can arise when using `AbstractFFTs` directly, but I am loading `FFTW`! What am I doing wrong? (Julia 1.9)

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [May 13, 2023, 8:10pm UTC](https://discourse.julialang.org/t/fftw-doesnt-work-in-a-module/98812/2 "2023-05-13T20:10:27Z")

</div>

I cannot reproduce. What is `] status`?

```julia
(jl_GLoe9p) pkg> st
Status `/tmp/jl_GLoe9p/Project.toml`
  [7a1cc6ca] FFTW v1.6.0

julia> using FFTW

julia> fft(rand(10))
10-element Vector{ComplexF64}:
    4.896886342005173 + 0.0im
  0.18327191936496529 + 0.29830948141388797im
    0.935521475377004 - 0.17167934311914898im
 -0.17940527689522684 + 0.5852170086797646im
 -0.11841056344565581 - 0.0925211085118875im
   2.3039704664349037 + 0.0im
 -0.11841056344565581 + 0.0925211085118875im
 -0.17940527689522684 - 0.5852170086797646im
    0.935521475377004 + 0.17167934311914898im
  0.18327191936496529 - 0.29830948141388797im

julia> module Testing
       using FFTW

       f() = fft(rand(10))
       export f
       end
Main.Testing

julia> using .Testing

julia> f()
10-element Vector{ComplexF64}:
    6.027681880991698 + 0.0im
   1.1674495100205002 + 0.10481311722367466im
  -1.8103182770071855 + 0.006523397541876766im
 -0.47206067938739077 + 0.17300716642828937im
  -0.4526906680456204 + 0.1266905360758629im
  -0.5400836578665337 + 0.0im
  -0.4526906680456204 - 0.1266905360758629im
 -0.47206067938739077 - 0.17300716642828937im
  -1.8103182770071855 - 0.006523397541876766im
   1.1674495100205002 - 0.10481311722367466im

```
