Unable to run python script - please help

Help please.

When I try to run a python script in Iclone 8 I get this error below and cannot run any scripts. I have confirmed placement of files and run it as administrator.

<class ‘AttributeError’>, File: C:/Program Files/Reallusion/iClone 8/Bin64/OpenPlugin/JEPlugins/BasicScript.py, Line: 5, Function:

I have confirmed that python is running and have attempted to run many different scripts and cannot get any version to work.

Here is the last script I tried last.

import RLPy

print(“:white_check_mark: Python is running inside iClone!”)

scene = RLPy.RScene.Instance()

if scene is None:
print(“:x: Error: iClone Scene could not be accessed.”)
else:
print(“:white_check_mark: iClone Scene is accessible.”)

List all objects in the scene

all_objects = scene.GetAllObjects()
if not all_objects:
print(“:warning: No objects found in the scene. Try adding a character.”)
else:
print(f":white_check_mark: Found {len(all_objects)} objects in the scene.“)
for obj in all_objects:
print(f”- {obj.GetName()} ({obj.GetType()})")

The errors output:
<class ‘AttributeError’>, File: C:/Program Files/Reallusion/iClone 8/Bin64/OpenPlugin/JEPlugins/BasicScript.py, Line: 5, Function:

<class ‘AttributeError’>, File: C:/Program Files/Reallusion/iClone 8/Bin64/OpenPlugin/JEPlugins/BasicScript.py, Line: 5, Function:
<class ‘AttributeError’>, File: unknown, Line: unknown, Function: unknown

There’s no such function as RLPy.RScene.Instance()
and neither is there a GetAllObjects().

This should work in iClone.

import RLPy

rl_plugin_info = { "ap": "iClone", "ap_version": "8.0" }

print(f"Python is running inside {RLPy.RApplication.GetProductName()}!")

# List all objects in scene (there are more Object types you can search for)
all_objects = RLPy.RScene.FindObjects(RLPy.EObjectType_Avatar |
                                      RLPy.EObjectType_Prop |
                                      RLPy.EObjectType_Light |
                                      RLPy.EObjectType_Camera)
if all_objects:
    print(f"Found {len(all_objects)} objects in the scene.")
    for obj in all_objects:
        print(f" - {obj.GetName()} ({obj.GetType()})")

Thanks so much for your reply! I will run this and see if it works as soon as I return home. I am just trying to confirm python can find the objects in the scene and I my python isn’t corrupt because multiple scripts and trials have not worked so it’s great to have this confirmed example.

I didn’t find much on the internet beyond the wiki for tutorials for coding /examples using python in reallusion. Do you have any recommendations?

Thanks so much for your help. It worked!

For API resources:

There’s the IC8 python API wiki:
https://wiki.reallusion.com/IC8_Python_API

The samples on Github were written for iClone 7, so don’t always work in iC8, but they can be useful to lead you in the right direction.

And you can always look at other plugins:

(though it’s getting a bit big and complicated these days, but just about everything I’ve ever figured out about the iC8/CC4 Python API is in there somewhere)

Thanks so much Victor! I love your blender plugins and the work you have done with Reallusion. Thanks for your guidance and time and the level of excellence you put into your work.