# Same name, different package

**URL:** <https://forum.kirupa.com/t/same-name-different-package/280971>\
**Category:** Uncategorized\
**Created:** [February 3, 2009, 4:14pm UTC](https://forum.kirupa.com/t/same-name-different-package/280971 "2009-02-03T16:14:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![forumSteve](https://avatars.discourse-cdn.com/v4/letter/f/a88e4f/32.png) [@forumSteve](https://forum.kirupa.com/u/forumSteve)\
**Post date:** [February 3, 2009, 4:14pm UTC](https://forum.kirupa.com/t/same-name-different-package/280971/1 "2009-02-03T16:14:29Z")

</div>

How do you declare a variable type that is the same name as the current class in a different package? Is it possible?

[COLOR=black][FONT=Verdana]I’m importing the class and using getDefinitionByName for the instantiation. However, without declaring a variable of that time, the class is not being imported.[/FONT][/COLOR]

```auto

[FONT=Verdana][COLOR=black][COLOR=black][FONT=Verdana]package a {[/FONT][/COLOR]
[INDENT][COLOR=black][FONT=Verdana]public class CustomClass {[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]}[/FONT][/COLOR]
[/INDENT][COLOR=black][FONT=Verdana]}[/FONT][/COLOR]
[/COLOR][/FONT]

```

[FONT=Verdana][COLOR=black]

```auto

[COLOR=black][FONT=Verdana][COLOR=black][FONT=Verdana]package b {[/FONT][/COLOR]
[INDENT][COLOR=black][FONT=Verdana]import a.CustomClass;[/FONT][/COLOR]
import flash.utils.getDefinitionByName;
 
[COLOR=black][FONT=Verdana]public class CustomClass {[/FONT][/COLOR]
[INDENT][COLOR=black][FONT=Verdana]private var _customClassA : ?????[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]private var _customClassB : CustomClass;[/FONT][/COLOR]
 
[COLOR=black][FONT=Verdana]public function CustomClass {[/FONT][/COLOR]
[INDENT][COLOR=black][FONT=Verdana]_customClassA = new ( getDefinitionByName( "a::CustomClass" ) );[/FONT][/COLOR]
[/INDENT][COLOR=black][FONT=Verdana]}[/FONT][/COLOR]
[/INDENT][COLOR=black][FONT=Verdana]}[/FONT][/COLOR]
[/INDENT][COLOR=black][FONT=Verdana]} [/FONT][/COLOR]
[/FONT][/COLOR]

```

[/COLOR][/FONT]
