SGTK: launch application from a DCC script editor eg: Maya/Nuke

Hello,
I am unable to launch application from a DCC script editor eg: Maya/Nuke.
I have been referring this link for reference,
Bootstrapping
Below is the code snippet,
I am working in a company, where Shotgrid is setup for the show.
I open app from shotgrid desktop application. So that i am in show/shot env

import sgtk
current_engine = sgtk.platform.current_engine()
print(current_engine.context)
authenticator = sgtk.authentication.ShotgunAuthenticator()
user = authenticator.get_user()
sgtk.set_authenticated_user(user)

mgr = sgtk.bootstrap.ToolkitManager(user)

mgr.pipeline_configuration = "Primary"
mgr.do_shotgun_config_lookup = True

mgr.plugin_id = "basic.*"

task = {'type': 'Project', 'id': 781}

engine = mgr.bootstrap_engine("tk-maya", entity=task)

Result: <TkManager User bghuntla

Bundle cache fallback paths
Caching policy 0
Plugin id basic.*
Config name Primary
Base None > #

But when i run the below command i get this error

Error: SystemError: file /home/bghuntla/.shotgun//p781c1184.basic.desktop/cfg/install/core/python/tank/platform/engine.py line 1207: Parent module ‘tank.platform’ not loaded, cannot perform relative import

mgr.plugin_id = "basic.*"

task = {'type': 'Project', 'id': 781}

engine = mgr.bootstrap_engine("tk-maya", entity=task)

can you please let me know where I am going wrong.

2022-02-28T18:30:00Z