Python Forum
Possible to create an object inside another object that is visible outside that objec
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Possible to create an object inside another object that is visible outside that objec
#4
(May-24-2023, 06:11 AM)Gribouillis Wrote:
(May-24-2023, 01:10 AM)MeghansUncle2 Wrote: I know it sounds confusing so I'll try to illustrate the question
Please post a complete example. As it is, the code is not understandable, for example
self.myobj = myclass
 
 
self.myobj(parameters)
cannot run because myclass has not been previously defined and parameters has not been defined, and also self has not been defined. Try to write code that we can run.

This is not actual code. It is an abstract form of code to illustrate my question.

The question is, can i use an object created within another object outside of that other object. in my example, can i access object "B" outside of object "A"

Main Code
Self.A = Aclass

Self.A .somemethod
...
A class
class Aclass(object):

def somemethod()
       self.B = Bclass
I know I left out a lot and this code will not stand on its own. I am asking is there a way to reference the B object from the main code (outside of the A object)?
Reply


Messages In This Thread
RE: Possible to create an object inside another object that is visible outside that objec - by MeghansUncle2 - May-24-2023, 02:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Merge htm files with shutil library (TypeError: 'module' object is not callable) Melcu54 7 3,418 Mar-09-2025, 04:25 PM
Last Post: Pedroski55
  type object 'man' has no attribute 'centerX' Tempo 7 851 Mar-07-2025, 03:47 AM
Last Post: deanhystad
  float object can't be interpreted as an integer t23 2 913 Jan-18-2025, 07:36 PM
Last Post: deanhystad
  Storing DictProxy object and modifying its nested value? haihal 3 1,083 Dec-20-2024, 04:58 AM
Last Post: deanhystad
  Extract args=, value that was passed to Multiprocessing.Proc object during runtime? haihal 1 646 Dec-08-2024, 07:04 AM
Last Post: Gribouillis
  what is solution to save and reload a object? eue 4 2,076 Nov-23-2024, 02:15 PM
Last Post: DeaD_EyE
  Trying to get JSON object in python and process it further Creepy 2 1,029 Oct-24-2024, 08:46 AM
Last Post: buran
  How to move an object over time rather than instantly? temlotresid6 3 1,709 Oct-23-2024, 11:20 AM
Last Post: temlotresid6
  Forward __getattr__ to another object. deanhystad 1 770 Aug-30-2024, 07:16 AM
Last Post: Gribouillis
  How can I upload a .gz file to the Swift Object Storage using Python swift client? Hanginium65 0 758 Jul-24-2024, 03:24 PM
Last Post: Hanginium65

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020