Hello,
There is a chapter in manual named "Running an instance from code: full example", have you checked that? Is there any specific question or problem you got from that code?
Thank you I'll try that.