[Bf-python] Modules
Willian Padovani Germano
wgermano at ig.com.br
Wed Jun 30 20:36:17 CEST 2004
Hi,
----- Original Message -----
From: "J.L. Coenders" <blender at universalgrid.nl>
To: <bf-python at blender.org>
Sent: Wednesday, June 30, 2004 2:37 PM
Subject: [Bf-python] Modules
> It is probably possible to create your own modules, but I cannot really find a
> clear how to make them with my own function definitions in it.
>
> Does anyone have an example?
Any script in Python can be imported from another script and so is a module.
But since all code in the module is executed upon importing, modules should only
contain definitions (for functions, classes and variables), not actual calls,
so:
#- my_module.py
# This is a module
my_var = 10
def my_function():
print "Hi"
#----
is an example of a module. You just need to put it somewhere in your Python
path to be able to load it from another script (import my_module). Is this what
you asked? If you mean a module written in C, then look at the doc/ dir in
Blender's cvs, there's an outdated text there that is still useful.
--
Willian, wgermano at ig.com.br
More information about the Bf-python
mailing list