def FindOurFolder(folder): libs = poser.Libraries() # A list of all Runtime folders available base = u'Runtime/Textures/' + folder # Our texture folder path found = False # found will be set to True if our folder exists for lib in libs: lib = lib.replace('\\', '/') # We only want to use forward slashes path = '/'.join((lib, base)) # Create a full path ... if os.path.exists(path): # ... and check if it exists found = True # If so, set our flag to True ... break # ... and stop checking the remaining libraries return (None, path)[found] # Return the path if found, else return None