I want to define a NON-UPROPERY member in Python, which is not successful with various methods. My code is as follows:
import unreal import ftrack_api @unreal.uclass() class FTrackProxyImplementation(unreal.FTrackProxy): @unreal.ufunction(override=True) def create_session(self, url, key, username): try: self.__session = ftrack_api.Session(server_url = url, api_key = key, api_user = username) print(self.__session) return True except Exception: return False @unreal.ufunction(override=True) def close_session(self): unreal.log_warning("This is the Python test") print(self.__session)
The following error occurred in the console:
LogPython: <ftrack_api.session.Session object at 0x000001FA1202BC50> LogSlate: Window 'Message' being destroyed LogPython: Warning: This is the Python test LogScript: Error: Script Msg: Traceback (most recent call last): File "D:/MyProjects/RTXProject/Plugins/FTrackBridge/Content/Python/FTrackProxy.py", line 24, in close_session print(self.__session) AttributeError: 'FTrackProxyImplementation' object has no attribute '_FTrackProxyImplementation__session' LogScript: Error: Script call stack: FTrackProxyImplementation.CloseSession
Obviously, the members of the object (self.__session) have been destroyed. Is there a solution for it?