Using add_filter and add_action Inside a Plugin

Someone correct me if I am wrong, but I discovered from trial and error today that you have to deactivate and activate a plugin each time you use add_filter or add_action inside of the main plugin index.php file. I only tried add_filter, but I assume add_action is the same… I tried several times to get an add_filter hook to work from a plugin’s index.php file that previously worked in my theme’s functions.php file to no avail. The solution seemed to be deactivating and reactivating the plugin after adding a filter or action hook to index.php, but please someone comment on this post if they know differently or can confirm this behavior for WordPress plugin creators.