I have a Python script which I want to execute using Python Add-In button class. Right now, I am using following:
class child(object):
"""Implementation for Toolbar_addin.button2 (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
os.system('C:/temp/child.py')
but it returns nothing when I click Python Add-In button as part of sub-menu. Is it the right way to fire child scripts using button class?
Note: child script works perfectly as a stand alone script
Best Answer
@NathanW's suggestion works for me and is what I would suggest doing as well.
I have in the Install folder within my Python Add-in directory:
child.py
:(when run standalone prints the current time as read from the just-written file)
TestChildScriptAddin.py
:(when clicked, the current time is written to the file)
This works fine for me at 10.1 SP1. Have you tried doing something similar (barebones test)?