# Unbound type error while importing

**URL:** <https://forum.dfinity.org/t/unbound-type-error-while-importing/12543>\
**Category:** Language Support\
**Tags:** Motoko\
**Created:** [April 30, 2022, 6:06am UTC](https://forum.dfinity.org/t/unbound-type-error-while-importing/12543 "2022-04-30T06:06:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![formulaRoot](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/formularoot/32/5336_2.png) [@formulaRoot](https://forum.dfinity.org/u/formulaRoot)\
**Post date:** [April 30, 2022, 6:06am UTC](https://forum.dfinity.org/t/unbound-type-error-while-importing/12543/1 "2022-04-30T06:06:54Z")

</div>

I am splitting my code into different modules.

In my main.mo I have the following:

```auto
import Principal "mo:base/Principal";

import Profile "profile"; 

actor App {
let users : HashMap.HashMap<Principal, Profile> = HashMap.HashMap<Principal, Profile> (0, Principal.equal, Principal,hash); 

//I have a bunch of functions here 

}

```

In profile.mo :

```auto
module {
public type Profile = {
    fname : Text; 
    lname : Text; 
    }

}

```

The issue that I am facing is that when I import the Profile module that lives in profile.mo I get the following error:

```auto
src/app/profile
unbound type Profile

```

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [April 30, 2022, 8:20am UTC](https://forum.dfinity.org/t/unbound-type-error-while-importing/12543/2 "2022-04-30T08:20:01Z")

</div>

It’s probably because you should prefix with module or re-declare your types.

For example I’ve got in `./types/types.mo`:

```auto
import Principal "mo:base/Principal";

module {
    public type UserId = Principal;
}

```

When I want to use it else where like in `manager/manager.mo` I redeclare the types to shorten the usages:

```auto
import Types "../types/types";

actor Manager {
    private type UserId = Types.UserId;

    // Then I can use UserId ...

    public func something(): async (UserId) {
        let userId: UserId = ....
    };

```

But I guess it should work out too without redeclaring but by prefixing with modules:

```auto
import Types "../types/types";

actor Manager {
    
    // Then I can use Types.UserId ...

    public func something(): async (Types.UserId) {
        let userId: Types.UserId = ....
    };

```

---

<div class="post-metadata">

**Author:** ![formulaRoot](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/formularoot/32/5336_2.png) [@formulaRoot](https://forum.dfinity.org/u/formulaRoot)\
**Post date:** [April 30, 2022, 11:26pm UTC](https://forum.dfinity.org/t/unbound-type-error-while-importing/12543/3 "2022-04-30T23:26:18Z")

</div>

Got it. I wasnt redeclaring before using it. Thanks @peterparker That fixed it!
