[Feature Request] Pass custom parameters to `App`
See original GitHub issue(I know textual is still in active development and that this might be in the works, but just throwing it up here to help keep track)
There’s no way to pass in and store values inside a class that inherits from App
, to store application-level information. For instance, the following code does not work:
class MyApp(App):
def __init__(self, custom_arg, *args, **kwargs):
self.custom_arg = custom_arg
super().__init__(*args, **kwargs)
async def on_mount(self):
print(self.custom_arg)
MyApp(5).run()
The cause of this seems the be that in the run()
function, a new instance of MyApp
is created, which is the instance on which on_mount()
is actually caused. This is a bit annoying and requires using global variables to store the parameters we want, which is not ideal.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5
Top Results From Across the Web
Create custom parameters for advanced tracking - Google Help
Custom parameters are an advanced type of URL parameter that you can add to your ad's landing page URLs. Unlike ValueTrack parameters, you...
Read more >Passing custom parameters to pre-registration action from ...
Yes! This is possible. The custom parameters you pass to the /authorize request can be retrieved in the event.request property in the Pre ......
Read more >Is there a way to pass a custom parameter when make a call ...
Finally, I received a response from Twilio Support: Unfortunately you cannot add custom parameters such as below.
Read more >How to pass custom parameter in cart checkout into request?
Solved: Hi everybody, I want to pass an own ID while checking out my cart. That ID should be saved in my request...
Read more >Feature requests - Passbase
Add Feature Request ... Add feature to allow custom document uploads. ... of default tab in the Passbase dashboard or through a parameter...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Because I came looking for this, The above code is slightly wrong. More correct is:
Did we solve your problem?
Consider buying the Textualize developers a coffee to say thanks.
– Textualize