Command "CopyPrim" not working in standalone script

Problem

Command “CopyPrim” works in my custom extension but fails when invoked in a standalone .py script

Code

create_prim( "/World/BinObjs/part01_0000",
             "Xform",
             usd_path=f"{ROOTDIR}/assets/bin_objects/part01.usd",
             semantic_label="binObj",
            )

omni.kit.commands.execute("CopyPrim", 
                          path_from="/World/BinObjs/part01_0000", 
                          path_to="/World/BinObjs/part01_0001")

Error Msg

In extension, code runs fine.

In standalone python script, however, it gives error:
Cannot insert duplicate registry entry for usd layer SdfLayer('...') and
Failed verification

Full error trace at terminal:

2022-04-25 03:40:56 [19,669ms] [Error] [omni.usd.commands.usd_commands] /World/BinObjs/part01_0001 does not exist
2022-04-25 03:40:56 [19,670ms] [Error] [omni.kit.commands.command] Failed to execute a command: CopyPrim.
  File "extension_examples/user_examples/scene_generation/scene_generation_standalone.py", line 329, in <module>
    binObjs = setup_scene()
  File "extension_examples/user_examples/scene_generation/scene_generation_standalone.py", line 250, in setup_scene
    omni.kit.commands.execute("CopyPrim", path_from=f"{prim_path}_0000", path_to=f"{prim_path}_{i:04d}", duplicate_layers=True, combine_layers=False)
  File "/media/gpuadmin/4TB/smartgrasping/omniverse/.local/share/ov/pkg/isaac_sim-2021.2.1/kit/extscore/omni.kit.commands/omni/kit/commands/command.py", line 235, in execute
    return omni.kit.undo.execute(command, name, kwargs)
[...skipped...]
  File "/media/gpuadmin/4TB/smartgrasping/omniverse/.local/share/ov/pkg/isaac_sim-2021.2.1/kit/extscore/omni.kit.commands/omni/kit/undo/undo.py", line 72, in execute
    result = _execute(command, name, level, history_key)
  File "/media/gpuadmin/4TB/smartgrasping/omniverse/.local/share/ov/pkg/isaac_sim-2021.2.1/kit/extscore/omni.kit.commands/omni/kit/undo/undo.py", line 312, in _execute
    raise e
  File "/media/gpuadmin/4TB/smartgrasping/omniverse/.local/share/ov/pkg/isaac_sim-2021.2.1/kit/extscore/omni.kit.commands/omni/kit/undo/undo.py", line 279, in _execute
    result = command.do()
  File "/media/gpuadmin/4TB/smartgrasping/omniverse/.local/share/ov/pkg/isaac_sim-2021.2.1/kit/extscore/omni.usd/omni/usd/commands/usd_commands.py", line 334, in do
    omni.usd.duplicate_prim(stage, self._path_from, self._path_to, self._duplicate_layers)
  File "/media/gpuadmin/4TB/smartgrasping/omniverse/.local/share/ov/pkg/isaac_sim-2021.2.1/kit/extscore/omni.usd/omni/usd/_impl/utils.py", line 878, in duplicate_prim
    introducing_layer, intro_prim_path = omni.usd.get_introducing_layer(usd_prim)
  File "/media/gpuadmin/4TB/smartgrasping/omniverse/.local/share/ov/pkg/isaac_sim-2021.2.1/kit/extscore/omni.usd/omni/usd/_impl/utils.py", line 242, in get_introducing_layer
    query = Usd.PrimCompositionQuery(prim)

 <class 'pxr.Tf.ErrorException'>
        Error in 'pxrInternal_v0_20__pxrReserved__::Sdf_LayerRegistry::InsertOrUpdate' at line 155 in file /buildAgent/work/ca6c508eae419cf8/USD/pxr/usd/sdf/layerRegistry.cpp : 'Cannot insert duplicate registry entry for usd layer SdfLayer('extension_examples/user_examples/scene_generation/assets/bin_objects/part01.usd', 'extension_examples/user_examples/scene_generation/assets/bin_objects/part01.usd') over existing entry for usd layer SdfLayer('extension_examples/user_examples/scene_generation/assets/bin_objects/part01.usd', 'extension_examples/user_examples/scene_generation/assets/bin_objects/part01.usd')'
        Error in 'pxrInternal_v0_20__pxrReserved__::SdfLayer::_OpenLayerAndUnlockRegistry' at line 3054 in file /buildAgent/work/ca6c508eae419cf8/USD/pxr/usd/sdf/layer.cpp : 'Failed verification: ' _layerRegistry-> FindByIdentifier(layer->GetIdentifier()) == layer ' -- Could not find extension_examples/user_examples/scene_generation/assets/bin_objects/part01.usd'

Question

  1. Could you kindly advice how to resolved this error?
  2. Why is the behavior different when the same code runs in extension VS in standalone mode?

Any hint is much appreciated. Thanks~