There is very likely an encoding issue during the exec part of the code as sasid by @tevemadar
The way this is done also would be quite looked down upon. Exec's are dangerous as they can easily be exploited.
Imports exist for a reason. Try wrapping your bs4 code in a function maybe and import that to your main file. You can call it then ;)