calling python file
- Abdulkareem
 - Offline
 - Senior Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 77
 - Thank you received: 2
 
			
	
						31 Oct 2024 15:46				#313538
		by Abdulkareem
	
	
		
			
	
			
			 		
													
	
				calling python file was created by Abdulkareem			
			
				i have a python script that runs automatically when i start linuxcnc, i want to make a button in the ui that runs the script when i click on it. i use this code to run it (loadusr python3 /home/abdulkareem/linuxcnc/configs/Ethercat_FInal/import_logging.py) in the postgui file iam using axis ui.			
					Please Log in or Create an account to join the conversation.
- Aciera
 - 
				
											 - Offline
 - Administrator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 4557
 - Thank you received: 2029
 
			
	
						31 Oct 2024 16:04				#313539
		by Aciera
	
	
		
			
	
			
			 		
													
	
				Replied by Aciera on topic calling python file			
			
				- Use the same procedure you used to create the custom Mcode for the python scirpt here:
forum.linuxcnc.org/20-g-code/54265-calling-python-file#313421
- Create a new HAL_COMMAND entry in the [HALUI] section of your ini file (change M code number to the one you are using):
MDI_COMMAND = M199
- Make sure the [HAL] section of your ini file contains this entry:
HALUI = halui
Then connect your GUI button to the MDI_COMMAND in your hal file:
net call_script => halui.mdi-command-00 <= <your_vcp_button_pin_here>
					forum.linuxcnc.org/20-g-code/54265-calling-python-file#313421
- Create a new HAL_COMMAND entry in the [HALUI] section of your ini file (change M code number to the one you are using):
MDI_COMMAND = M199
- Make sure the [HAL] section of your ini file contains this entry:
HALUI = halui
Then connect your GUI button to the MDI_COMMAND in your hal file:
net call_script => halui.mdi-command-00 <= <your_vcp_button_pin_here>
Please Log in or Create an account to join the conversation.
		Time to create page: 0.118 seconds