#๐Ÿ”’ How to create global variables dynamically from a method in base class defined in a separate file?

26 messages ยท Page 1 of 1 (latest)

near tapirBOT
#

@toxic crane

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

mild heart
#

why we doing this again ? pithink

#

!e

globals()["x"] = 5

print(x)
near tapirBOT
mild heart
frail grove
#

This is a topic for #esoteric-python

mild heart
frail grove
#

It's needs to traverse frames so yeah

mild heart
#

but why

#

what u doing that needs this

frail grove
#

You need to get the f_globals out of sys._getframe

rose topaz
#

why r we doing this

frail grove
#

But like don't be doing that

#

I don't see where you're using was

#

I'm on a phone

mild heart
#

cant u just import this file and use was from there ?

frail grove
#

๐Ÿคณ

mild heart
#

why not ?

frail grove
#

Ty

#

Where do you pass var_name?

mild heart
#

from filename import function pithink

#

is issue due to globals ?

#

i genuily am so lost here

#

ik globals is per file

near tapirBOT
#
Python help channel closed using Discord native close action

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.