If you are using the PsychoPyßBuilder, it will import all libraries that have online counterparts. Importing python-libraries does work for online-experiments. Note that not all functionality might be offered. See the crib sheet for functions that need manual translation.