If you "install" your Python module, you'll be able to do this.
These assume that you still want to be able to edit your code wherever you have it on your local machine:
# doing it in a non-global way (i.e., just for the current user)
# from the directory containing your "setup.py" file
pip install --user -e .
# and as long as ~/.local/bin is in your path:
mycode
If you want to make it available to every user on the machine,
# install an "editable" copy of the code from the current directory
# into the global Python installation
pip install -e .
# this will install it next to pip and your other Python tools
mycode
Note you don't need to specify main in your setup.py either:
entry_points = {'gui_scripts': ['mycode = mycode:main',],},