Assuming you're on Windows, this is just changing the file type association, which ultimately is a registry value change, though users usually don't need to make registry changes directly.
As described here, if you just want to do this on your computer, you can make this change in file explorer by right-clicking a file, selecting 'open with' and selecting your program and electing to make that program the default.
In Windows 10 and Windows 11, you can also use the default apps settings.
When users open files with associated file types, the file path will be passed to your application as an argument. Your application will need to read the arguments (in Python, from sys.argv
) and take appropriate steps to 'open' the file -- whatever that means for your app.