How do I add to "group" when function is outside the "storyboard" parts

Hello,

I have some functions that create images. I usually place my functions in the top part of the storyboard under the"BEGINNING OF YOUR IMPLEMENTATION" part.

Together with all my variables that I set up.

But when I use a function that creates an image I cannot place it at the top.  The group it needs does not exist yet. 

The function is called from a touch event in the storyboard parts. 

Is there a way to keep my functions at the top and still add them to my group in the same function?

Now I just moved the function to a place within the storyboard section and it works.

Thanks

Have you tried using:

[lua]scene.view:insert( image )[/lua]

And if you need to change the z order, you can use.

[lua]image:toFront() – front in group[/lua]

and 

[lua]image:toBack() – back in group[/lua]

Have you tried using:

[lua]scene.view:insert( image )[/lua]

And if you need to change the z order, you can use.

[lua]image:toFront() – front in group[/lua]

and 

[lua]image:toBack() – back in group[/lua]