THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/07/2012 at 06:01, xxxxxxxx wrote:
@mchaloner: I don't think "run pretty quick" is the correct term, here. The code doesn't run faster because the code-size is small. It just loads faster, and loading is done at Cinema 4D startup.
Also, outsourcing of code should be done in a "senseful way". Don't seperate each function to another source file. Importing does take it's take, too (when you want to decrease loading time).
When you know where your source-files are (and you usually do, because they're in your plugin folder), instead of appending the path of the plugin's directory, rather insert it at the beginning of the sys.path list.
In the former case, the Python Interpreter would walk through each folder in sys.path and finally gets to your plugin's path after it has traversed a number of other directories. In the latter, it will find your module at the first path in sys.path.