I know that in Pure Data there are ways to open the patch using bang, for example.
Is it possible to do the reverse? Create a message or object that closes a patch so that I don't have to close Pure Data by clicking the "X" in the window?
Something like a "close bang"
- 
				
				
				
				Is there any object or message in Pure Data to close patches? 
 
- 
				
				
				
				@lucassilveira Send a [menuclose( message to the canvas using either [iemguts/sendcanvas] or name the canvas with [namecanvas] and use [send canvasname] if you want to go vanilla. You will have to send a [dirty 0( or a [menusave( if you do not want the save dialog to open up. Edit: just remembered, deleting the main canvas like this crashes pd, info in the [namecanvas] help file. Not sure you can do it without crashing pd. 
- 
				
				
				
				There is also [vis 0( 
 And you can send all these messages to subpatches, too (as they are canvases kind of!?).For example [pd sub] [x] 
 |
 [vis $1(
 [
 [s pd-sub]or [;pd-sub vis 0( 
- 
				
				
				
				@lucassilveira You can close a patch from another patch with the [menuclose( message. 
 But you cannot do so "internally"........ the message has to come from another patch or Pd will crash.
 One patch has to still be running.
 Long thread here....... https://forum.pdpatchrepo.info/topic/11710/closing-patches-without-pd-crashing-hopefully-in-an-elegant-way
 I deleted most of my posts in that thread as I was so embarrassed being upvoted for attempts at solving the problem that then proved unreliable.
 You will see that you can send a message to a patch without naming the canvas..... so vanilla..
 [;
 pd-nameofpatch.pd menuclose(
 David.
 
					 
									 
									