Part 1: Copy Script
I have scripts on my computer that I want to continue to develop. These scripts work as embed scripts in maya files, so that people who open the file will get the tool upon opening it. I want to build in an update function, so that when I open the file, the version in the file will check against my local version, and if my local version is a higher version number, it will update to my script. I know how to replace the string value in maya, but i'm not certain how to copy the string value from an existing python file.
How can I copy the text from within a script to a string value? (preferably containing /n and indentation, while I'm at it)
version = 3.1
Try:
import ToolBox
if ToolBox.version > version:
#do copy stuff
Part 2: Multiple Script Files
My script uses several separate files (simplified concept bellow)
file Hammer
class Type():
#force stuff
def strike():
#strike stuff
file Nail
Class Type():
#Type stuff
def bindTogether():
#bind stuff
file Wood
#wood stuff..
file ToolBox
Import Hammer
Import Nail
Import Wood
def buildBox():
#buildBox stuff using hammer, nail and wood
Can I import these into a class within my script and use them pretty much the same as I am now? If not, what can I do?
File Toolbox
Class Hammer:
class Type():
#force stuff
def strike():
#strike stuff
Class Nail:
Class Type():
#Type stuff
def bindTogether():
#bind stuff
Class Wood:
#wood stuff
def buildBox():
#buildBox stuff using hammer, nail and wood