Answers.Body: <p>As far as I remember there is no possibility within NXT-G to programmatically execute another program. Moreover, as I understand it the default firmware simply doesn't have that possibility (the command to start a program is a direct command which must be sent via bluetooth and can't be used in a program). Maybe other programming languages using other firmware can do it, but I don't know about that.</p>
  
  <p>However, you could encapsulate certain parts of your program in your own blocks, which I would say are similar to C functions. As such, it will simplify your main program, and you can reuse blocks in different programs (but the blocks themselves are included in the program file, it's not like a library which would be a different file). You should probably read a <a href="http://www.nxtprograms.com/help/MyBlocks/tutorial.html" rel="nofollow">tutorial on how to make your own blocks</a> to decide if it's a valid solution for you.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2013-04-24T07:01:58.400Z
Answers.LastActivityDate: 2013-04-24T07:01:58.400Z
Answers.UserDisplayName: Joubarc
Body: <p>I'm using NXT-G to program my robot to do few tasks autonomously for so many possibilities. When using C programming, we can call a function from different file into the main program. So, I wonder if it is possible to write a program that can run another program for one possibility and run another program for other possibility?</p>
  
Tags: <programming><nxt-g>
Title: Set to run a program within another program using NXT-G
UserDisplayName: woklut
ThreadText: # Set to run a program within another program using NXT-G
  
  (Asked by: username_0 on 2013-04-24)
  
  I'm using NXT-G to program my robot to do few tasks autonomously for so many possibilities. When using C programming, we can call a function from different file into the main program. So, I wonder if it is possible to write a program that can run another program for one possibility and run another program for other possibility?
  
  **Tags:** programming, nxt-g
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2013-04-24. Score: 4
  
  As far as I remember there is no possibility within NXT-G to programmatically execute another program. Moreover, as I understand it the default firmware simply doesn't have that possibility (the command to start a program is a direct command which must be sent via bluetooth and can't be used in a program). Maybe other programming languages using other firmware can do it, but I don't know about that.
  
  However, you could encapsulate certain parts of your program in your own blocks, which I would say are similar to C functions. As such, it will simplify your main program, and you can reuse blocks in different programs (but the blocks themselves are included in the program file, it's not like a library which would be a different file). You should probably read a [tutorial on how to make your own blocks](http://www.nxtprograms.com/help/MyBlocks/tutorial.html) to decide if it's a valid solution for you.
  
  
  ---
  
  