<viz>.director

Execute a function asynchronously

 

<viz>.director(
    function    
    *args    
    **kwargs    

)

 

function

A function or callable object


*args

Optional arguments to pass on to the director function


**kwargs

Optional keyword arguments to pass on to the director function


Remarks

This command executes the specified function in a separate thread, thereby allowing you to perform operations that would otherwise halt rendering of the world or the execution of other code within the script. Examples are input/output operations like fileIO and downloading a file from the Internet.

Return Value

None

Example

def example():
   
    file = open('data.txt', 'r')    
   
    for line in file:
        last = line
   
    file.close()

    viz.logNotice('The last line is: ',last)
   
viz.director(example)

See also

<viz>.waitKeyPress
<viz>.waitFrame
<viz>.waitTime