# Initialize classObj automatically for an exposed function

**URL:** https://forum.makecode.com/t/initialize-classobj-automatically-for-an-exposed-function/2583
**Category:** micro:bit
**Created:** [June 30, 2020, 12:03pm UTC](https://forum.makecode.com/t/initialize-classobj-automatically-for-an-exposed-function/2583 "2020-06-30T12:03:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ameyrr250](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@ameyrr250](https://forum.makecode.com/u/ameyrr250)
#### Post date: [June 30, 2020, 12:03pm UTC](https://forum.makecode.com/t/initialize-classobj-automatically-for-an-exposed-function/2583/1 "2020-06-30T12:03:25Z")

</div>

Hi,  
I want to have all my functions in a class for each main block. Right now what I do is,

namespace ABC{  
//% block=“create lcd settings”  
//% blockSetVariable=“ABCObjSettings”  
//% weight=110  
export function createABCObjSettings(): ABCObjSettings{  
return new ABCObjSettings();  
}  
export class ABC{

…  
…  
…

//% block="$this example $variablePassed  
//% blockId=Example  
//% blockNamespace=ABC  
//% this.shadow=variables\_get  
//% this.defl=“ABCObjSettings”  
//% weight=90  
exampleExposedFunction(variablePassed : number) {

sum=this.variablePassed

}

}

}

In the blocks on the webpage, I have to first place the “set ABCObjSettings to create lcd settings”, then select my exposed function.  
I have to place the “set ABCObjSettings to create lcd settings” at least once to use any exposed

Is there a way to automatically create that Object and use?

Thanks!
