Integrating scripts question for toxic exporter. Help needed

Hi.

I am writing an export script for the physically accurate GI renderer toxic http://toxicengine.sourceforge.net/index.php. I have written a basic export script incorporating some of the .obj export code from objmodif228.py. I have now written a seperate GUI script which makes the setting.xml file needed by the exporter.

In the GUI script I need to effectively run the other script when a certain GUI event occurs. How do I do this within a single script (if possible)? I tried defining the whole of the export script as a function but that failed miserably.

Please help if you can. I would like to release a new version of my script soon.

Thanks

Koba.