Python Forum
How to pass variables from one class to another
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to pass variables from one class to another
#7
(Sep-22-2021, 05:45 PM)deanhystad Wrote: I don't understand what you are saying. Write a realistic example of what you want to do. If you can do that with C++, great. I know C++. If you can't, use python and pseudocode.

So, the code goes from top to down, first reads class One, it reads the value, then reads the class after (class Two) and can pass the value from class One to class Two. This is what you showed me with your code and what I have found on google. That's fine...this is example 2, where the flow goes from up to down.

What I face in my code is the opposite (ex.1). The code reads first class One that needs read_distance value, but it does not have it because the class that does that work is class Two, which is after class One. The code will reach class Two, after class One. This is where I believe my code "explodes"...

What can I do?

In C++ you can fix that, I do not know how to fix it in python..

Attached Files

Thumbnail(s)
   
Reply


Messages In This Thread
RE: How to pass variables from one class to another - by hobbyist - Sep-22-2021, 06:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Unchangeable variables in a class? Calab 12 1,638 Sep-15-2023, 07:15 PM
Last Post: deanhystad
  How to pass encrypted pass to pyodbc script tester_V 0 899 Jul-27-2023, 12:40 AM
Last Post: tester_V
  Class variables and Multiprocessing(or concurrent.futures.ProcessPoolExecutor) Tomli 5 3,947 Nov-12-2021, 09:55 PM
Last Post: snippsat
  Acess variables from class samuelbachorik 3 1,927 Aug-20-2021, 02:55 PM
Last Post: deanhystad
Exclamation win32com: How to pass a reference object into a COM server class Alfalfa 3 4,947 Jul-26-2021, 06:25 PM
Last Post: Alfalfa
  Do I have to pass 85 variables to function? Milfredo 10 4,370 Sep-26-2020, 10:13 PM
Last Post: Milfredo
  Pass by object reference when does it behave like pass by value or reference? mczarnek 2 2,592 Sep-07-2020, 08:02 AM
Last Post: perfringo
  Class variables menator01 2 2,039 Jun-04-2020, 04:23 PM
Last Post: Yoriz
  Question about naming variables in class methods sShadowSerpent 1 2,036 Mar-25-2020, 04:51 PM
Last Post: ndc85430
  Pass by reference vs Pass by value leodavinci1990 1 2,233 Nov-20-2019, 02:05 AM
Last Post: jefsummers

Forum Jump:

User Panel Messages

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