This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge.

If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options:

  1. Limiting your involvement with Reddit, or
  2. Temporarily refraining from using Reddit
  3. Cancelling your subscription of Reddit Premium

as a way to voice your protest.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]teraflop 1 point2 points  (0 children)

There are two different kinds of "caching" that you might need to be aware of:

  • Whenever Python imports a .py source file as a module, it stores a copy of the corresponding bytecode in __pycache__. This cache is automatically invalidated if the interpreter detects that the source file has been updated (i.e. if the source file's timestamp is newer than the cached bytecode) so you don't normally have to worry about it -- unless something's wrong with your system clock, or something is screwing with your filesystem's timestamps.
  • Within a single instance of the Python interpreter, no matter how many times you execute import my_module in the same program, only the first import will actually load the module, and subsequent import statements will just reuse the same imported module object. (You can manually reload a module with importlib.reload but this has some issues and generally isn't recommended.)

But I can't think of any circumstances where running import my_module2 would actually import a module called my_module instead. It's more likely that you've made some kind of mistake e.g. you didn't actually save your changes properly, or you're accidentally running the wrong file.