Hi Sam. 
What you want to make is basically a python 'package' . I.e, a dir with a 
sensible name, containing the seperate scripts ('modules'), plus an __init__.py 
file. The folder (package) is then its own import call as long as it is in your 
python path. So lets say your package/folder is called 'character' :

In this 'character' folder you have a blank text file called __init__.py which 
can serve further purposes, but essentially is there to recognise this package 
on import. Now its all down to namespaces. So you can put a script in here 
called 'hands.py' for example. 

Your call to a function in your 'hands' module would be something like :

Import character as char
Import char.hands
char.hands.buildHands()

In here you can import legs, arms or anything else in the hands module or 
whatever. But you can also use a userSetup.py within your 'character' package. 
Put all your imports there if you like. So when you :
Import character
It will import all modules as per names/imports you've specified in your 
userSetup automatically, that you can now refer to directly. Just don't loose 
track of your designated namespaces and be consistant with them if you don't 
want confusion in module-to-module function calls.

As for class's...it is not imperritive to make everything you do object 
oriented. Classes are primarily a tool for instanciatian and inherritance. 
Maybe slightly overkill for just running functions that perform simple 
algorythms. Depends how you prefer to script and if the task your completing 
requires it.

Hope that helps

Simon

Sent from my iPhone

> On 19 Apr 2016, at 21:00, [email protected] wrote:
> 
> Hey all, 
> 
> i have finished a large script which effectively builds a new mesh topology 
> from an underlying sculpt mesh. My script is currently approaching the 3000 
> line mark. Its is hard to navigate and i wanted to break into modules which i 
> can trigger off from a main script.
> 
> i want to have one script organised like this:
> 
> 1) do hands (call hands creation modules)
> 2) do arms (call arms module)
> 3) do legs (call legs module)
> 4) do feet (call feet module)
> 5) do torso (call torso module)
> 6) do head (call head module)
> 
> 7) combine surfaces and merge verts
> 
> i understand the principle of modules but i just wanted to make sure if this 
> is a smart way to organise it. And if someone could just give me a basic set 
> of steps i could take to achieve it. Im not clear whether everything needs to 
> be a class for example.
> 
> And there are common functions which each module in turn needs to call in 
> order to build their meshes, and i don't know if the modules will be able to 
> see the functions they require. I assume if i want to keep the main script 
> minimal i will need all those smaller functions i created (that each module 
> would need to access) in their own module.
> 
> then there are also 'packages' and whether this is a better solution?
> 
> sorry a bit long, but thought it best i really understand this before i spend 
> days sifting through this script and creating more problems for myself in the 
> end.
> 
> thanks alot guys, 
> Sam
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/python_inside_maya/605c97e4-0835-4054-a9a2-0aaa53036828%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/3140B17C-CA49-48F5-87C7-DC4EFD4ECDE2%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to